【发布时间】:2014-07-29 08:07:52
【问题描述】:
我创建了一个基于示例应用程序的 Spring Boot - Security 项目,但是 Rest Controller 工作正常,这意味着我可以访问其余资源但安全性似乎根本没有启动,所以当我添加断点时如下所述,它不会在那里中断。不知道为什么。
@Configuration
@EnableWebSecurity
public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// @formatter:off
auth.inMemoryAuthentication() // breakpoint here
.withUser("roy")
.password("spring")
.roles("ADMIN");
// @formatter:on
}
@Override
@Bean
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
}
这是使用 Codio 托管和编辑的完整项目:http://bit.ly/1uFI0t5
【问题讨论】:
-
尝试添加@EnableAutoConfiguration 注解。
标签: java spring spring-security spring-boot