我创建了基于示例应用程序的Spring Boot - Security项目,但是Rest Controller正常工作,意味着我可以访问其余资源,但安全性似乎根本不会启动,所以当我添加如下所述的断点时,它不会在那里出现。不知道为什么。Spring Security - 身份验证没有启动
@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注释。 –
是的我有, – xybrek