Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
l jh
a1
Commits
4f54ae2c
Commit
4f54ae2c
authored
5 years ago
by
sgjj
Browse files
Options
Download
Email Patches
Plain Diff
修复启动错误
parent
e8f2f849
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/net/mingsoft/config/WebConfig.java
+16
-11
src/main/java/net/mingsoft/config/WebConfig.java
with
16 additions
and
11 deletions
+16
-11
src/main/java/net/mingsoft/config/WebConfig.java
+
16
-
11
View file @
4f54ae2c
...
...
@@ -53,18 +53,23 @@ public class WebConfig implements WebMvcConfigurer {
@Override
public
void
addResourceHandlers
(
ResourceHandlerRegistry
registry
)
{
registry
.
addResourceHandler
(
"/upload/**"
).
addResourceLocations
(
"file:"
+
BasicUtil
.
getRealPath
(
"upload"
)
+
File
.
separator
);
registry
.
addResourceHandler
(
"/html/**"
).
addResourceLocations
(
"file:"
+
BasicUtil
.
getRealPath
(
"html"
)
+
File
.
separator
);
registry
.
addResourceHandler
(
"/templets/**"
).
addResourceLocations
(
"file:"
+
BasicUtil
.
getRealPath
(
"templets"
)
+
File
.
separator
);
registry
.
addResourceHandler
(
"/app/**"
).
addResourceLocations
(
"file:"
+
BasicUtil
.
getRealPath
(
"app"
)
+
File
.
separator
,
"classpath:/app/"
);
registry
.
addResourceHandler
(
"/static/**"
).
addResourceLocations
(
"file:"
+
BasicUtil
.
getRealPath
(
"static"
)
+
File
.
separator
,
"classpath:/static/"
);
registry
.
addResourceHandler
(
"/api/**"
).
addResourceLocations
(
"file:"
+
BasicUtil
.
getRealPath
(
"api"
)
+
File
.
separator
,
"classpath:/api/"
);
//jar包方式映射处理
String
classPath
=
BasicUtil
.
getClassPath
(
""
);
if
(
classPath
.
startsWith
(
"file"
))
{
registry
.
addResourceHandler
(
"/upload/**"
).
addResourceLocations
(
"file:"
+
BasicUtil
.
getRealPath
(
"upload"
)
+
File
.
separator
);
registry
.
addResourceHandler
(
"/html/**"
).
addResourceLocations
(
"file:"
+
BasicUtil
.
getRealPath
(
"html"
)
+
File
.
separator
);
registry
.
addResourceHandler
(
"/templets/**"
).
addResourceLocations
(
"file:"
+
BasicUtil
.
getRealPath
(
"templets"
)
+
File
.
separator
);
}
else
{
//必须做判断,不然jar运行的html路径会被覆盖掉
registry
.
addResourceHandler
(
"/html/**"
).
addResourceLocations
(
"/html/"
);
}
registry
.
addResourceHandler
(
"/app/**"
).
addResourceLocations
(
"/app/"
,
"classpath:/app/"
);
registry
.
addResourceHandler
(
"/static/**"
).
addResourceLocations
(
"/static/"
,
"classpath:/static/"
);
registry
.
addResourceHandler
(
"/api/**"
).
addResourceLocations
(
"/api/"
,
"classpath:/api/"
);
}
/**
* druidServlet注册
*/
/**
* druidServlet注册
*/
@Bean
public
ServletRegistrationBean
druidServletRegistration
()
{
ServletRegistrationBean
registration
=
new
ServletRegistrationBean
(
new
StatViewServlet
());
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help