Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
cms_sys
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
西魏
cms_sys
Commits
9e733b32
Commit
9e733b32
authored
Sep 06, 2019
by
sgjj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交配置
parent
212b6b15
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
30 deletions
+8
-30
WebConfig.java
src/main/java/net/mingsoft/config/WebConfig.java
+7
-30
application.yml
src/main/resources/application.yml
+1
-0
No files found.
src/main/java/net/mingsoft/config/WebConfig.java
View file @
9e733b32
...
...
@@ -32,16 +32,6 @@ import net.mingsoft.basic.util.BasicUtil;
@Configuration
public
class
WebConfig
implements
WebMvcConfigurer
{
/**
* 上传路径
*/
@Value
(
"${ms.upload.path}"
)
private
String
uploadFloderPath
;
/**
* 上传路径映射
*/
@Value
(
"${ms.upload.mapping}"
)
private
String
uploadMapping
;
@Bean
public
ActionInterceptor
actionInterceptor
()
{
return
new
ActionInterceptor
();
...
...
@@ -65,25 +55,13 @@ public class WebConfig implements WebMvcConfigurer {
@Override
public
void
addResourceHandlers
(
ResourceHandlerRegistry
registry
)
{
//jar包方式映射处理
String
classPath
=
BasicUtil
.
getClassPath
(
""
);
//jar包获取的路径带有file
if
(
classPath
.
startsWith
(
"file"
))
{
//判断是否设置的绝对路径
registry
.
addResourceHandler
(
"/html/**"
).
addResourceLocations
(
"file:"
+
BasicUtil
.
getRealPath
(
"html"
)
+
File
.
separator
);
registry
.
addResourceHandler
(
"/templets/**"
).
addResourceLocations
(
"file:"
+
BasicUtil
.
getRealPath
(
"templets"
)
+
File
.
separator
);
registry
.
addResourceHandler
(
"/app/**"
).
addResourceLocations
(
"classpath:/app/"
);
registry
.
addResourceHandler
(
"/api/**"
).
addResourceLocations
(
"classpath:/api/"
);
}
//如果是绝对路径添加映射
if
(
uploadFloderPath
.
startsWith
(
"file:"
)){
//如果指定了绝对路径,上传的文件都映射到uploadMapping下
registry
.
addResourceHandler
(
uploadMapping
).
addResourceLocations
(
uploadFloderPath
+
File
.
separator
//映射其他路径文件
//,file:F://images
);
}
registry
.
addResourceHandler
(
"/static/**"
).
addResourceLocations
(
"/static/"
,
"classpath:/static/"
);
registry
.
addResourceHandler
(
"/upload/**"
).
addResourceLocations
(
"/upload/"
,
"file:upload/"
);
registry
.
addResourceHandler
(
"/templets/**"
).
addResourceLocations
(
"/templets/"
,
"file:templets/"
);
registry
.
addResourceHandler
(
"/html/**"
).
addResourceLocations
(
"/html/"
,
"file:html/"
);
//三种映射方式 webapp下、当前目录下、jar内
registry
.
addResourceHandler
(
"/app/**"
).
addResourceLocations
(
"/app/"
,
"file:app/"
,
"classpath:/app/"
);
registry
.
addResourceHandler
(
"/static/**"
,
"/**"
).
addResourceLocations
(
"/static/"
,
"file:static/"
,
"classpath:/static/"
);
registry
.
addResourceHandler
(
"/api/**"
).
addResourceLocations
(
"/api/"
,
"file:api/"
,
"classpath:/api/"
);
}
/**
...
...
@@ -157,7 +135,6 @@ public class WebConfig implements WebMvcConfigurer {
xssFilter
.
excludes
.
add
(
".*file/upload.do"
);
xssFilter
.
excludes
.
add
(
".*/jsp/editor.do"
);
registration
.
addUrlPatterns
(
"/*"
);
return
registration
;
}
...
...
src/main/resources/application.yml
View file @
9e733b32
...
...
@@ -54,6 +54,7 @@ spring:
time_format
:
HH:mm:ss
datetime_format
:
yyyy-MM-dd HH:mm:ss
auto_import
:
/include/macro.ftl as ms
number_format
:
0.##
mybatis
:
mapper-locations
:
classpath*:**/dao/*.xml
...
...
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