Commit a40cfc0e authored by Shen's avatar Shen

1. admin模块添加静态资源访问,解决与swagger冲突问题

parent 2e8f45ff
......@@ -33,6 +33,7 @@ public class SwaggerConfig {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.host("byyl.zjhmit.com")
.apiInfo(apiInfo())
.select()
//加了ApiOperation注解的类,生成接口文档
......
......@@ -57,6 +57,7 @@ public class ShiroConfig {
shiroFilter.setFilters(filters);
Map<String, String> filterMap = new LinkedHashMap<>();
filterMap.put("/static/**", "anon");
filterMap.put("/webjars/**", "anon");
filterMap.put("/druid/**", "anon");
filterMap.put("/login", "anon");
......
......@@ -14,6 +14,7 @@ import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.text.SimpleDateFormat;
......@@ -23,6 +24,13 @@ import java.util.TimeZone;
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/swagger2/**").addResourceLocations("classpath:/swagger2/");
registry.addResourceHandler("/static/**").addResourceLocations("file:/home/websoft/java_jar/pension_service/myfile/");
// registry.addResourceHandler("/static/**").addResourceLocations("file:D:/upload/pension/");
}
@Override
public void addCorsMappings(CorsRegistry registry) {
......
......@@ -72,5 +72,6 @@ mybatis-plus:
call-setters-on-nulls: true
jdbc-type-for-null: 'null'
QR:
# download-path: D:/upload/pension/
# download-path: /home/resourse/bsqzc/ D:/123/ /home/websoft/java_jar/pension_service/myfile/
download-path: /home/websoft/java_jar/pension_service/myfile/
......@@ -27,7 +27,7 @@ public class SwaggerConfig {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.host("byyl.zjhmit.com")
// .host("byyl.zjhmit.com")
.apiInfo(apiInfo())
.select()
//加了ApiOperation注解的类,才生成接口文档
......
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