Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
pension
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mengmeng
pension
Commits
1ec5f002
Commit
1ec5f002
authored
May 07, 2021
by
Shen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.重新配置静态资源访问,解决静态资源访问和swagger冲突的问题。
parent
d03b1ddc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
3 deletions
+13
-3
ApiApplication.java
hmit-api/src/main/java/io/hmit/ApiApplication.java
+1
-0
StaticMvcConfigurer.java
...api/src/main/java/io/hmit/config/StaticMvcConfigurer.java
+3
-3
WebMvcConfig.java
hmit-api/src/main/java/io/hmit/config/WebMvcConfig.java
+8
-0
application.yml
hmit-api/src/main/resources/application.yml
+1
-0
No files found.
hmit-api/src/main/java/io/hmit/ApiApplication.java
View file @
1ec5f002
...
@@ -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
...
...
hmit-api/src/main/java/io/hmit/config/StaticMvcConfigurer.java
View file @
1ec5f002
...
@@ -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
);
}
}
...
...
hmit-api/src/main/java/io/hmit/config/WebMvcConfig.java
View file @
1ec5f002
...
@@ -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
;
...
...
hmit-api/src/main/resources/application.yml
View file @
1ec5f002
...
@@ -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/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment