spring - org.springframework.security.authentication.AuthenticationManager 类型无法解析。它是从所需的 .class 文件间接引用的

标签 spring spring-security

@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/

相关文章:

spring-security - Spring Security Apple 登录

java - Spring 框架: Byte Array is corrupted when received

spring-security - Spring Security 3 SavedRequestAwareAuthenticationSuccessHandler 不保存原始请求

spring - 在生产服务器中部署时是否应该更改 mongo bean 的值?

hibernate - 组织.hibernate.LazyInitializationException : failed to lazily initialize a collection of role (Hibernate + Spring)

java - 创建自定义方法安全表达式的最佳方法

spring - 使用Spring Security修改基本身份验证授权流程?

grails - 使用获取表单搜索来确保Grails安全URL的安全

java - 服务和 DAO 总是实现接口(interface)

java.lang.classcastException com.ibm.ws.rsadapter.jdbc.wsjdbcconnection 与 oracle.jdbc.oracleConnection 不兼容