Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
MCMS
Commits
f5f9d29b
Commit
f5f9d29b
authored
Apr 08, 2021
by
wujj
Browse files
资源访问问题
parent
f8644faa
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/net/mingsoft/config/WebConfig.java
View file @
f5f9d29b
...
...
@@ -93,7 +93,8 @@ public class WebConfig implements WebMvcConfigurer {
public
void
addResourceHandlers
(
ResourceHandlerRegistry
registry
)
{
registry
.
addResourceHandler
(
uploadMapping
).
addResourceLocations
(
File
.
separator
+
uploadFloderPath
+
File
.
separator
,
"file:"
+
uploadFloderPath
+
File
.
separator
,
"classpath:/template/"
);
registry
.
addResourceHandler
(
"/template/**"
).
addResourceLocations
(
File
.
separator
+
template
+
File
.
separator
,
"file:"
+
template
+
File
.
separator
,
"classpath:/html/"
);
registry
.
addResourceHandler
(
File
.
separator
.
concat
(
htmlDir
).
concat
(
File
.
separator
).
concat
(
"**"
)).
addResourceLocations
(
File
.
separator
.
concat
(
htmlDir
).
concat
(
File
.
separator
),
"file:"
.
concat
(
htmlDir
).
concat
(
File
.
separator
));
//注意这里的htmlDir资源不能使用File.separator替代"/",会导致Windows一键版访问失效
registry
.
addResourceHandler
(
htmlDir
.
concat
(
"/**"
)).
addResourceLocations
(
htmlDir
.
concat
(
"/"
),
"file:"
.
concat
(
htmlDir
).
concat
(
"/"
));
//三种映射方式 webapp下、当前目录下、jar内
registry
.
addResourceHandler
(
"/app/**"
).
addResourceLocations
(
"/app/"
,
"file:app/"
,
"classpath:/app/"
);
registry
.
addResourceHandler
(
"/static/**"
).
addResourceLocations
(
"/static/"
,
"file:static/"
,
"classpath:/static/"
,
"classpath:/META-INF/resources/"
);
...
...
src/main/resources/application.yml
View file @
f5f9d29b
...
...
@@ -13,7 +13,7 @@ logging:
path
:
log
#会在项目的根目录下生成log目录,里面会生成对应的日期目录,日期目录下面生成日志压缩包备份文件,默认按每10M分割一个日志文件,例如:log/2020-01/app-2020-01-03-18.1.log.gz(表示2020年1月3号下午六点的第一个备份),也可以根据实际情况写绝对路径,例如:d:/log
ms
:
diy
:
html-dir
:
html
html-dir
:
/
html
# scheme: https #解决使用代理服务器代理应用时标签解析域名依旧为http的问题
swagger
:
enable
:
false
#启用swagger文档,生产的时候务必关掉 访问地址:http://ip|域名/项目发布名/swagger-ui.html
...
...
Write
Preview
Supports
Markdown
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