Commit 33a36402 by Nepxion

适配Spring Cloud Api Gateway,不装载Swagger

parent 0e9185c9
...@@ -10,6 +10,7 @@ package com.nepxion.discovery.plugin.admincenter.configuration; ...@@ -10,6 +10,7 @@ package com.nepxion.discovery.plugin.admincenter.configuration;
*/ */
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.CorsRegistry;
...@@ -26,6 +27,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; ...@@ -26,6 +27,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration @Configuration
@EnableSwagger2 @EnableSwagger2
@ConditionalOnClass(name = { "javax.servlet.ServletContext" }) // 适配Spring Cloud Api Gateway,不装载Swagger
public class SwaggerConfiguration implements WebMvcConfigurer { public class SwaggerConfiguration implements WebMvcConfigurer {
@Value("${spring.application.name}") @Value("${spring.application.name}")
private String serviceName; private String serviceName;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment