Commit 1ec5f002 authored by Shen's avatar Shen

1.重新配置静态资源访问,解决静态资源访问和swagger冲突的问题。

parent d03b1ddc
......@@ -4,6 +4,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
/**
* @author zsh 408538940@qq.com
......
......@@ -11,14 +11,14 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupp
* @Date : 2021/5/7 13:48
*/
@Configuration
//@Configuration
public class StaticMvcConfigurer extends WebMvcConfigurationSupport {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/static/**")
.addResourceLocations("file:D:/123/");
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("file:/home/websoft/java_jar/pension_service/myfile/");
registry.addResourceHandler("swagger-ui.html", "/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/","classpath:/META-INF/resources/webjars/");
super.addResourceHandlers(registry);
}
......
......@@ -18,6 +18,7 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConvert
import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.text.SimpleDateFormat;
......@@ -32,8 +33,15 @@ 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:D:/123/");
}
@Autowired
private AuthorizationInterceptor authorizationInterceptor;
@Autowired
private LoginUserHandlerMethodArgumentResolver loginUserHandlerMethodArgumentResolver;
......
......@@ -70,6 +70,7 @@ mybatis-plus:
cache-enabled: false
call-setters-on-nulls: true
jdbc-type-for-null: 'null'
QR:
# download-path: D:/123/ /home/websoft/java_jar/pension_service/myfile/
download-path: /home/websoft/java_jar/pension_service/myfile/
......
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