mirror of
https://github.com/dqjdda/Aurora.git
synced 2018-11-06 05:33:29 +00:00
新增锁屏功能
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package me.aurora.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@@ -11,6 +13,11 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
@Configuration
|
||||
public class ConfigurerAdapter implements WebMvcConfigurer {
|
||||
|
||||
@Bean
|
||||
LockInterceptor lockInterceptor(){
|
||||
return new LockInterceptor();
|
||||
}
|
||||
|
||||
/**
|
||||
* 以前要访问一个页面需要先创建个Controller控制类,再写方法跳转到页面
|
||||
* 在这里配置后就不需要那么麻烦了,直接访问http://localhost/login.html就跳转到login页面了
|
||||
@@ -32,4 +39,12 @@ public class ConfigurerAdapter implements WebMvcConfigurer {
|
||||
registry.addViewController("/login.html").setViewName("/user/login");
|
||||
registry.addViewController("/signUp.html").setViewName("/register");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
/**
|
||||
* 添加锁屏的拦截器,并添加过滤规则
|
||||
*/
|
||||
registry.addInterceptor(new LockInterceptor()).addPathPatterns("/**").excludePathPatterns("/login.html","/user/lock.html","/logout","/login","/user/unlock","/css/**","/js/**","/plugins/**","/swagger/**");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user