Commit 1ec5f002 authored by Shen's avatar Shen

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

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