[英]Can I use two interceptors on same spring boot application?
I have a Spring Boot application that contains two different dashboards, and so each user can access only one.我有一个包含两个不同仪表板的 Spring Boot 应用程序,因此每个用户只能访问一个。 Actually I have one interceptor that secure one dashboard, but the second dashboard needs another interceptor.实际上我有一个拦截器来保护一个仪表板,但第二个仪表板需要另一个拦截器。 This is possible?这个有可能?
This is my configuration class:这是我的配置类:
@Configuration
public class SecurityConfiguration implements WebMvcConfigurer{
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new AutorizadorInterceptorEscola());
}
}
I need to add another interceptor to secure the second dashboard.我需要添加另一个拦截器来保护第二个仪表板。
Create Configuration Class extends with WebMvcConfigurerAdapter使用 WebMvcConfigurerAdapter 创建配置类扩展
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new GuestInterceptor());
registry.addInterceptor(new AdminInterceptor());
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.