Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
l jh
a1
Commits
df3e10c6
Commit
df3e10c6
authored
5 years ago
by
ms group dev
Browse files
Options
Download
Email Patches
Plain Diff
配置更新
parent
8800fb66
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/net/mingsoft/config/WebConfig.java
+16
-4
src/main/java/net/mingsoft/config/WebConfig.java
with
16 additions
and
4 deletions
+16
-4
src/main/java/net/mingsoft/config/WebConfig.java
+
16
-
4
View file @
df3e10c6
package
net.mingsoft.config
;
import
java.io.File
;
import
org.springframework.aop.Advisor
;
import
org.springframework.aop.support.DefaultPointcutAdvisor
;
import
org.springframework.aop.support.JdkRegexpMethodPointcut
;
...
...
@@ -23,6 +25,7 @@ import com.alibaba.druid.support.spring.stat.BeanTypeAutoProxyCreator;
import
com.alibaba.druid.support.spring.stat.DruidStatInterceptor
;
import
net.mingsoft.basic.interceptor.ActionInterceptor
;
import
net.mingsoft.basic.util.BasicUtil
;
@Configuration
public
class
WebConfig
implements
WebMvcConfigurer
{
...
...
@@ -50,10 +53,19 @@ public class WebConfig implements WebMvcConfigurer {
@Override
public
void
addResourceHandlers
(
ResourceHandlerRegistry
registry
)
{
registry
.
addResourceHandler
(
"/html/**"
).
addResourceLocations
(
"/html/"
);
registry
.
addResourceHandler
(
"/app/**"
).
addResourceLocations
(
"classpath:/app/"
);
registry
.
addResourceHandler
(
"/static/**"
).
addResourceLocations
(
"classpath:/static/"
);
registry
.
addResourceHandler
(
"/api/**"
).
addResourceLocations
(
"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
(
"classpath:/app/"
);
registry
.
addResourceHandler
(
"/static/**"
).
addResourceLocations
(
"classpath:/static/"
);
registry
.
addResourceHandler
(
"/api/**"
).
addResourceLocations
(
"classpath:/api/"
);
}
/**
...
...
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