提交 fd648f2e authored 作者: inroi's avatar inroi

微调

上级 8aa58d67
package com.framework.core.config;
//import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import com.framework.core.constant.CommonConstant;
import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.PathSelectors;
......@@ -27,7 +28,7 @@ import java.util.List;
@Configuration
@EnableSwagger2
//@ConditionalOnProperty(name = "swagger.enabled", havingValue = "true")
public class SwaggerConfig extends WebMvcConfigurationSupport {
public class SwaggerConfig implements WebMvcConfigurer {
//api接口包扫描路径
public static final String SWAGGER_SCAN_BASE_PACKAGE = "com";
@Value("${spring.application.name}")
......@@ -113,7 +114,7 @@ public class SwaggerConfig extends WebMvcConfigurationSupport {
.version("1.0")
// .termsOfServiceUrl("NO terms of service")
// 描述
.description(applicationName+"后台API接口")
.description(applicationName + "后台API接口")
// 作者
// .contact("")
.license("The Apache License, Version 2.0")
......@@ -123,21 +124,14 @@ public class SwaggerConfig extends WebMvcConfigurationSupport {
/**
* 防止@EnableMvc把默认的静态资源路径覆盖了,手动设置的方式
*
* @param registry
*/
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
// 解决静态资源无法访问
registry.addResourceHandler("/**")
.addResourceLocations("classpath:/static/");
// 解决swagger无法访问
registry.addResourceHandler("/swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
// 解决swagger的js文件无法访问
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
}
}
......@@ -21,8 +21,9 @@ import java.util.List;
/**
* @author Inori
*/
@EnableWebMvc
@Configuration
public class WebMvcConfig extends WebMvcConfigurationSupport {
public class WebMvcConfig implements WebMvcConfigurer {
@Override
public void extendMessageConverters(List<HttpMessageConverter<?>> converters) {
......
......@@ -80,7 +80,7 @@ security:
client-id: user-client
client-secret: user-secret-8888
# user-authorization-uri: http://127.0.0.7:${server.port}/oauth/authorize
access-token-uri: http://localhost:${server.port}/oauth/token
access-token-uri: http://localhost:${server.port}/nzwz/oauth/token
resource:
jwt:
#key-uri: http://starbos-auth-system:6001/oauth/token_key
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论