mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-06 17:08:29 +08:00
ResourceMvcConfig
This commit is contained in:
parent
ef757b9182
commit
fc7c8fd2ef
@ -0,0 +1,40 @@
|
|||||||
|
package org.dromara.maxkey.autoconfigure;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||||
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
@EnableWebMvc
|
||||||
|
@AutoConfiguration
|
||||||
|
public class ResourceMvcConfig implements WebMvcConfigurer {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(ResourceMvcConfig.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||||
|
logger.debug("add Resource Handlers");
|
||||||
|
|
||||||
|
logger.debug("add statics");
|
||||||
|
registry.addResourceHandler("/static/**")
|
||||||
|
.addResourceLocations("classpath:/static/");
|
||||||
|
|
||||||
|
logger.debug("add templates");
|
||||||
|
registry.addResourceHandler("/templates/**")
|
||||||
|
.addResourceLocations("classpath:/templates/");
|
||||||
|
|
||||||
|
logger.debug("add swagger");
|
||||||
|
registry.addResourceHandler("swagger-ui.html")
|
||||||
|
.addResourceLocations("classpath:/META-INF/resources/");
|
||||||
|
|
||||||
|
logger.debug("add knife4j");
|
||||||
|
registry.addResourceHandler("doc.html")
|
||||||
|
.addResourceLocations("classpath:/META-INF/resources/");
|
||||||
|
|
||||||
|
registry.addResourceHandler("/webjars/**")
|
||||||
|
.addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||||
|
|
||||||
|
logger.debug("add Resource Handler finished .");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -38,7 +38,6 @@ import org.springframework.context.annotation.Bean;
|
|||||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||||
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;
|
||||||
|
|
||||||
@EnableWebMvc
|
@EnableWebMvc
|
||||||
@ -73,31 +72,6 @@ public class MaxKeyMvcConfig implements WebMvcConfigurer {
|
|||||||
@Autowired
|
@Autowired
|
||||||
HistorySignOnAppInterceptor historySignOnAppInterceptor;
|
HistorySignOnAppInterceptor historySignOnAppInterceptor;
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
||||||
logger.debug("add Resource Handlers");
|
|
||||||
logger.debug("add statics");
|
|
||||||
registry.addResourceHandler("/static/**")
|
|
||||||
.addResourceLocations("classpath:/static/");
|
|
||||||
|
|
||||||
logger.debug("add templates");
|
|
||||||
registry.addResourceHandler("/templates/**")
|
|
||||||
.addResourceLocations("classpath:/templates/");
|
|
||||||
|
|
||||||
logger.debug("add swagger");
|
|
||||||
registry.addResourceHandler("swagger-ui.html")
|
|
||||||
.addResourceLocations("classpath:/META-INF/resources/");
|
|
||||||
|
|
||||||
logger.debug("add knife4j");
|
|
||||||
registry.addResourceHandler("doc.html")
|
|
||||||
.addResourceLocations("classpath:/META-INF/resources/");
|
|
||||||
|
|
||||||
registry.addResourceHandler("/webjars/**")
|
|
||||||
.addResourceLocations("classpath:/META-INF/resources/webjars/");
|
|
||||||
|
|
||||||
logger.debug("add Resource Handler finished .");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInterceptors(InterceptorRegistry registry) {
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
//addPathPatterns 用于添加拦截规则 , 先把所有路径都加入拦截, 再一个个排除
|
//addPathPatterns 用于添加拦截规则 , 先把所有路径都加入拦截, 再一个个排除
|
||||||
|
|||||||
@ -10,6 +10,7 @@ org.dromara.maxkey.autoconfigure.SessionAutoConfiguration
|
|||||||
org.dromara.maxkey.autoconfigure.TokenAutoConfiguration
|
org.dromara.maxkey.autoconfigure.TokenAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.CasAutoConfiguration
|
org.dromara.maxkey.autoconfigure.CasAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.Oauth20AutoConfiguration
|
org.dromara.maxkey.autoconfigure.Oauth20AutoConfiguration
|
||||||
|
org.dromara.maxkey.autoconfigure.ResourceMvcConfig
|
||||||
org.dromara.maxkey.autoconfigure.Saml20AutoConfiguration
|
org.dromara.maxkey.autoconfigure.Saml20AutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.SocialSignOnAutoConfiguration
|
org.dromara.maxkey.autoconfigure.SocialSignOnAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.SwaggerConfig
|
org.dromara.maxkey.autoconfigure.SwaggerConfig
|
||||||
|
|||||||
@ -30,7 +30,6 @@ import org.springframework.boot.autoconfigure.AutoConfiguration;
|
|||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||||
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 org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||||
|
|
||||||
@ -48,30 +47,6 @@ public class MaxKeyMgtMvcConfig implements WebMvcConfigurer {
|
|||||||
@Autowired
|
@Autowired
|
||||||
PermissionInterceptor permissionInterceptor;
|
PermissionInterceptor permissionInterceptor;
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
||||||
logger.debug("add Resource Handlers");
|
|
||||||
|
|
||||||
logger.debug("add statics");
|
|
||||||
registry.addResourceHandler("/static/**")
|
|
||||||
.addResourceLocations("classpath:/static/");
|
|
||||||
logger.debug("add templates");
|
|
||||||
registry.addResourceHandler("/templates/**")
|
|
||||||
.addResourceLocations("classpath:/templates/");
|
|
||||||
|
|
||||||
logger.debug("add swagger");
|
|
||||||
registry.addResourceHandler("swagger-ui.html")
|
|
||||||
.addResourceLocations("classpath:/META-INF/resources/");
|
|
||||||
registry.addResourceHandler("/webjars/**")
|
|
||||||
.addResourceLocations("classpath:/META-INF/resources/webjars/");
|
|
||||||
|
|
||||||
logger.debug("add knife4j");
|
|
||||||
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
|
|
||||||
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
|
||||||
|
|
||||||
logger.debug("add Resource Handler finished .");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInterceptors(InterceptorRegistry registry) {
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
//addPathPatterns 用于添加拦截规则 , 先把所有路径都加入拦截, 再一个个排除
|
//addPathPatterns 用于添加拦截规则 , 先把所有路径都加入拦截, 再一个个排除
|
||||||
|
|||||||
@ -8,6 +8,7 @@ org.dromara.maxkey.autoconfigure.OneTimePasswordAutoConfiguration
|
|||||||
org.dromara.maxkey.autoconfigure.SmsAutoConfiguration
|
org.dromara.maxkey.autoconfigure.SmsAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.SessionAutoConfiguration
|
org.dromara.maxkey.autoconfigure.SessionAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.TokenAutoConfiguration
|
org.dromara.maxkey.autoconfigure.TokenAutoConfiguration
|
||||||
|
org.dromara.maxkey.autoconfigure.ResourceMvcConfig
|
||||||
org.dromara.maxkey.autoconfigure.SynchronizerAutoConfiguration
|
org.dromara.maxkey.autoconfigure.SynchronizerAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.SwaggerConfig
|
org.dromara.maxkey.autoconfigure.SwaggerConfig
|
||||||
org.dromara.maxkey.autoconfigure.Oauth20ClientAutoConfiguration
|
org.dromara.maxkey.autoconfigure.Oauth20ClientAutoConfiguration
|
||||||
|
|||||||
@ -31,7 +31,6 @@ import org.springframework.boot.autoconfigure.AutoConfiguration;
|
|||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||||
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 org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||||
|
|
||||||
@ -52,30 +51,6 @@ public class MaxKeyOpenApiMvcConfig implements WebMvcConfigurer {
|
|||||||
@Autowired
|
@Autowired
|
||||||
RestApiPermissionAdapter restApiPermissionAdapter;
|
RestApiPermissionAdapter restApiPermissionAdapter;
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
||||||
logger.debug("add Resource Handlers");
|
|
||||||
|
|
||||||
logger.debug("add statics");
|
|
||||||
registry.addResourceHandler("/static/**")
|
|
||||||
.addResourceLocations("classpath:/static/");
|
|
||||||
logger.debug("add templates");
|
|
||||||
registry.addResourceHandler("/templates/**")
|
|
||||||
.addResourceLocations("classpath:/templates/");
|
|
||||||
|
|
||||||
logger.debug("add swagger");
|
|
||||||
registry.addResourceHandler("swagger-ui.html")
|
|
||||||
.addResourceLocations("classpath:/META-INF/resources/");
|
|
||||||
registry.addResourceHandler("/webjars/**")
|
|
||||||
.addResourceLocations("classpath:/META-INF/resources/webjars/");
|
|
||||||
|
|
||||||
logger.debug("add knife4j");
|
|
||||||
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
|
|
||||||
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
|
||||||
|
|
||||||
logger.debug("add Resource Handler finished .");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInterceptors(InterceptorRegistry registry) {
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
//addPathPatterns 用于添加拦截规则 , 先把所有路径都加入拦截, 再一个个排除
|
//addPathPatterns 用于添加拦截规则 , 先把所有路径都加入拦截, 再一个个排除
|
||||||
|
|||||||
@ -5,6 +5,7 @@ org.dromara.maxkey.autoconfigure.JwtAuthnAutoConfiguration
|
|||||||
org.dromara.maxkey.autoconfigure.RedisAutoConfiguration
|
org.dromara.maxkey.autoconfigure.RedisAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.AuthnProviderAutoConfiguration
|
org.dromara.maxkey.autoconfigure.AuthnProviderAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.OneTimePasswordAutoConfiguration
|
org.dromara.maxkey.autoconfigure.OneTimePasswordAutoConfiguration
|
||||||
|
org.dromara.maxkey.autoconfigure.ResourceMvcConfig
|
||||||
org.dromara.maxkey.autoconfigure.SmsAutoConfiguration
|
org.dromara.maxkey.autoconfigure.SmsAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.SessionAutoConfiguration
|
org.dromara.maxkey.autoconfigure.SessionAutoConfiguration
|
||||||
org.dromara.maxkey.autoconfigure.TokenAutoConfiguration
|
org.dromara.maxkey.autoconfigure.TokenAutoConfiguration
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user