java - 在此行 : Factory bean not Found 处找到多个注释

标签 java spring spring-security

我正在 Spring Tool Suite(3.6.4.RELEASE) 中构建一个 Spring 项目。 我正在尝试使用maven将spring框架版本从4.0.3.RELEASE升级到4.2.7.RELEASE。

升级之前没有错误,一切运行顺利。现在项目正在编译和运行,没有错误,但登录页面没有显示,而且我的 spring 安全配置 xml 中也出现错误。

spring-security.xml 中的错误: enter image description here

STS 悬停时显示以下错误:

Multiple annotations found at this line:
- Factory bean 'org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser
 $DefaultWebSecurityExpressionHandlerBeanFactory' not found [config set: mcare-dashboard-web/web-context]
- Factory bean 'org.springframework.security.config.http.HttpConfigurationBuilder
 $SecurityContextHolderAwareRequestFilterBeanFactory' not found [config set: mcare-dashboard-web/web-context]

项目层次结构:

enter image description here

我的pom.xml如下所示:

enter image description here

然后我就这样更改了版本号:

enter image description here

之后 spring-security.xml 显示错误。

谁能解释一下为什么会发生这种情况?

最佳答案

您声明要将 Spring 从版本 4.0.3.RELEASE 升级到 4.2.7.RELEASE。无论多么有效,您都在升级 Spring 和 Spring Security。这是因为有一个名为 org.springframework-version 的版本属性来管理 Spring 和 Spring Security 依赖项的版本。

因此,将org.springframework-version更改为4.2.7.RELEASE也可以有效升级Spring Security。

要解决此问题,您需要有两个不同的版本属性,一个用于 Spring,另一个用于 Spring Security。您可以仅升级 Spring 或 Spring Security。

关于java - 在此行 : Factory bean not Found 处找到多个注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52962186/

相关文章:

javascript - 从浏览器运行本地网络服务器的可能性

java - 如何避免在 java spring 中使用同一 session 并发访问 Controller 方法?

java - Spring Security中的自定义表达式

jsf - 清除 h :messages after page refresh

java - 如何禁用解析作为 url 参数/从 url 传递的登录参数

java - Android:使用带有动态 url 的 Retrofit

java - 在mockito中模拟参数化 map

eclipse - Maven 依赖项未部署在 Eclipse Tomcat 实例上

java - 如何从Spring Boot连接在线MongoDB数据库?

java - Spring Security中PreAuthorize注解中使用permitAll()的目的