@Configuration
@ConditionalOnProperty(prefix="sohelp-boot.dev",
name="enabled",
havingValue="true",
matchIfMissing=true)
@ComponentScan(basePackages="net.sohelp.boot.dev")
public class DevCoreConfiguration
extends Object
implements org.springframework.web.servlet.config.annotation.WebMvcConfigurer
该配置类在 sohelp-boot.dev.enabled=true(默认)时生效,
并扫描 net.sohelp.boot.dev 包下的组件。
同时实现了 WebMvcConfigurer 接口,用于注册拦截器。
| 构造器和说明 |
|---|
DevCoreConfiguration() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addInterceptors(org.springframework.web.servlet.config.annotation.InterceptorRegistry registry)
添加拦截器到 Spring MVC 配置中。
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddArgumentResolvers, addCorsMappings, addFormatters, addResourceHandlers, addReturnValueHandlers, addViewControllers, configureAsyncSupport, configureContentNegotiation, configureDefaultServletHandling, configureHandlerExceptionResolvers, configureMessageConverters, configurePathMatch, configureViewResolvers, extendHandlerExceptionResolvers, extendMessageConverters, getMessageCodesResolver, getValidatorpublic void addInterceptors(org.springframework.web.servlet.config.annotation.InterceptorRegistry registry)
此方法将 LoginInterceptor 拦截器应用到指定路径模式,并排除部分无需鉴权的静态资源和接口。
addInterceptors 在接口中 org.springframework.web.servlet.config.annotation.WebMvcConfigurerregistry - 拦截器注册中心,用于添加、配置拦截器及其作用范围Copyright © 2026. All rights reserved.