swagger-ui替换为knife4j
This commit is contained in:
@@ -50,6 +50,7 @@
|
|||||||
<servlet-api.version>4.0.1</servlet-api.version>
|
<servlet-api.version>4.0.1</servlet-api.version>
|
||||||
<spring-data-elasticsearch.version>3.2.7.RELEASE</spring-data-elasticsearch.version>
|
<spring-data-elasticsearch.version>3.2.7.RELEASE</spring-data-elasticsearch.version>
|
||||||
<elasticsearch.version>7.8.0</elasticsearch.version>
|
<elasticsearch.version>7.8.0</elasticsearch.version>
|
||||||
|
<knife4j.version>2.0.4</knife4j.version>
|
||||||
<docker-maven-plugin.version>1.2.2</docker-maven-plugin.version>
|
<docker-maven-plugin.version>1.2.2</docker-maven-plugin.version>
|
||||||
<sonar.exclusions>zlt-job/**/*, zlt-register/**/*, zlt-web/**/*</sonar.exclusions>
|
<sonar.exclusions>zlt-job/**/*, zlt-register/**/*, zlt-web/**/*</sonar.exclusions>
|
||||||
<docker.baseImage>openjdk:8-jre-alpine</docker.baseImage>
|
<docker.baseImage>openjdk:8-jre-alpine</docker.baseImage>
|
||||||
@@ -358,6 +359,16 @@
|
|||||||
<artifactId>elasticsearch</artifactId>
|
<artifactId>elasticsearch</artifactId>
|
||||||
<version>${elasticsearch.version}</version>
|
<version>${elasticsearch.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
|
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||||
|
<version>${knife4j.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
|
<artifactId>knife4j-micro-spring-boot-starter</artifactId>
|
||||||
|
<version>${knife4j.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|||||||
+1
@@ -23,6 +23,7 @@ public class PermitProperties {
|
|||||||
"/*/v2/api-docs",
|
"/*/v2/api-docs",
|
||||||
"/swagger/api-docs",
|
"/swagger/api-docs",
|
||||||
"/swagger-ui.html",
|
"/swagger-ui.html",
|
||||||
|
"/doc.html",
|
||||||
"/swagger-resources/**",
|
"/swagger-resources/**",
|
||||||
"/webjars/**",
|
"/webjars/**",
|
||||||
"/druid/**"
|
"/druid/**"
|
||||||
|
|||||||
@@ -17,12 +17,8 @@
|
|||||||
<artifactId>spring-boot-starter</artifactId>
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.springfox</groupId>
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
<artifactId>springfox-swagger-ui</artifactId>
|
<artifactId>knife4j-micro-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.springfox</groupId>
|
|
||||||
<artifactId>springfox-swagger2</artifactId>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
|||||||
-17
@@ -1,17 +0,0 @@
|
|||||||
package com.central.common.swagger2;
|
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
||||||
import org.springframework.context.annotation.Import;
|
|
||||||
import springfox.documentation.swagger2.configuration.Swagger2DocumentationConfiguration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author zlt
|
|
||||||
* @date 2018/11/18 9:20
|
|
||||||
*/
|
|
||||||
@ConditionalOnProperty(name = "zlt.swagger.enabled", matchIfMissing = true)
|
|
||||||
@Import({
|
|
||||||
Swagger2DocumentationConfiguration.class
|
|
||||||
})
|
|
||||||
public class Swagger2Configuration {
|
|
||||||
}
|
|
||||||
+11
-4
@@ -1,16 +1,18 @@
|
|||||||
package com.central.common.swagger2;
|
package com.central.common.swagger2;
|
||||||
|
|
||||||
|
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.base.Predicates;
|
import com.google.common.base.Predicates;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import org.springframework.beans.BeansException;
|
|
||||||
import org.springframework.beans.factory.BeanFactory;
|
import org.springframework.beans.factory.BeanFactory;
|
||||||
import org.springframework.beans.factory.BeanFactoryAware;
|
import org.springframework.beans.factory.BeanFactoryAware;
|
||||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Import;
|
import org.springframework.context.annotation.Import;
|
||||||
|
import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration;
|
||||||
import springfox.documentation.builders.ApiInfoBuilder;
|
import springfox.documentation.builders.ApiInfoBuilder;
|
||||||
import springfox.documentation.builders.ParameterBuilder;
|
import springfox.documentation.builders.ParameterBuilder;
|
||||||
import springfox.documentation.builders.PathSelectors;
|
import springfox.documentation.builders.PathSelectors;
|
||||||
@@ -25,6 +27,7 @@ import springfox.documentation.service.SecurityReference;
|
|||||||
import springfox.documentation.spi.DocumentationType;
|
import springfox.documentation.spi.DocumentationType;
|
||||||
import springfox.documentation.spi.service.contexts.SecurityContext;
|
import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||||
import springfox.documentation.spring.web.plugins.Docket;
|
import springfox.documentation.spring.web.plugins.Docket;
|
||||||
|
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@@ -36,10 +39,14 @@ import java.util.stream.Collectors;
|
|||||||
/**
|
/**
|
||||||
* @author zlt
|
* @author zlt
|
||||||
* @date 2018/11/18 9:22
|
* @date 2018/11/18 9:22
|
||||||
|
* <p>
|
||||||
|
* Blog: https://zlt2000.gitee.io
|
||||||
|
* Github: https://github.com/zlt2000
|
||||||
*/
|
*/
|
||||||
@Import( {
|
@Configuration
|
||||||
Swagger2Configuration.class
|
@EnableSwagger2
|
||||||
})
|
@EnableKnife4j
|
||||||
|
@Import(BeanValidatorPluginsConfiguration.class)
|
||||||
public class SwaggerAutoConfiguration implements BeanFactoryAware {
|
public class SwaggerAutoConfiguration implements BeanFactoryAware {
|
||||||
private static final String AUTH_KEY = "Authorization";
|
private static final String AUTH_KEY = "Authorization";
|
||||||
|
|
||||||
|
|||||||
@@ -69,12 +69,8 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<!-- swagger -->
|
<!-- swagger -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.springfox</groupId>
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
<artifactId>springfox-swagger2</artifactId>
|
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.springfox</groupId>
|
|
||||||
<artifactId>springfox-swagger-ui</artifactId>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -72,16 +72,6 @@
|
|||||||
<artifactId>swagger-butler-core</artifactId>
|
<artifactId>swagger-butler-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.xiaoymin</groupId>
|
|
||||||
<artifactId>swagger-bootstrap-ui</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.zyplayer</groupId>
|
|
||||||
<artifactId>swagger-mg-ui</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
|
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
|
||||||
|
|||||||
Reference in New Issue
Block a user