【发布时间】:2016-07-20 02:13:33
【问题描述】:
在使用 spring-boot-starter-security:1.3.3:RELEASE 使用简单的 Web 应用程序测试 Spring Boot (1.3.3) 时,我观察到以下行为:
为了覆盖默认的 Spring web 安全配置,我提供了一个自定义的 Java 配置类,如下所示:
@Configuration
// @EnableWebSecurity apparently obsolete ?
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
// http security checking left out for brevity ...
}
@Override
protected void configure(
AuthenticationManagerBuilder auth) throws Exception {
// user authentication left out for brevity ...
}
}
启动后,应用程序重定向到登录页面并正确检查用户名/密码是否提供了@EnableWebSecurity 注释(如上例所示)。因此,此上下文中的此注释是否已过时?如果是这样,为什么?
【问题讨论】:
标签: spring-security spring-boot