@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("abcde").password("123456").roles("USER");
}
我在最后一行收到错误,它说
The type org.springframework.security.authentication.AuthenticationManager cannot be resolved. It is indirectly referenced from required .class files
我一直在寻找解决方案,但找不到修复它的方法。
最佳答案
将 spring-security-core 添加到您的构建路径中。 如果您已经有,请下载最新版本。
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>5.0.0.RELEASE</version>
</dependency>
在mvn clean install之后,如果您在eclipse中仍然看到错误。刷新项目。 这对我有用。
关于spring - org.springframework.security.authentication.AuthenticationManager 类型无法解析。它是从所需的 .class 文件间接引用的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37272814/