我正在 Spring Tool Suite(3.6.4.RELEASE) 中构建一个 Spring 项目。 我正在尝试使用maven将spring框架版本从4.0.3.RELEASE升级到4.2.7.RELEASE。
升级之前没有错误,一切运行顺利。现在项目正在编译和运行,没有错误,但登录页面没有显示,而且我的 spring 安全配置 xml 中也出现错误。
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]
项目层次结构:
我的pom.xml
如下所示:
然后我就这样更改了版本号:
之后 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/