'Cannot register alias 'springSecurityFilterChain' for name 'org.springframework.security.filterChainProxy'
Getting this error when I start my application.
WrapperJarApp Error: Caused by: java.lang.IllegalStateException: Cannot register alias 'springSecurityFilterChain' for name 'org.springframework.security.filterChainProxy': Alias would override bean definition 'springSecurityFilterChain'
WrapperJarApp Error: at org.springframework.beans.factory.support.DefaultListableBeanFactory.checkForAliasCircle(DefaultListableBeanFactory.java:1140)
WrapperJarApp Error: at org.springframework.core.SimpleAliasRegistry.registerAlias(SimpleAliasRegistry.java:80)
WrapperJarApp Error: at org.springframework.security.config.http.HttpSecurityBeanDefinitionParser.registerFilterChainProxyIfNecessary(HttpSecurityBeanDefinitionParser.java:356)
WrapperJarApp Error: at org.springframework.security.config.http.HttpSecurityBeanDefinitionParser.parse(HttpSecurityBeanDefinitionParser.java:115)
WrapperJarApp Error: at org.springframework.security.config.SecurityNamespaceHandler.parse(SecurityNamespaceHandler.java:105)
WrapperJarApp Error: at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1391)
WrapperJarApp Error: at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1371)
WrapperJarApp Error: at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:179)
WrapperJarApp Error: at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:149)
WrapperJarApp Error: at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:96)
WrapperJarApp Error: at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:511)
WrapperJarApp Error: at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391)
WrapperJarApp Error: ... 35 more
<-- Wrapper Stopped
I am using spring-boot 2.6.6 and spring-framework 5.3.18.
The web.xml have
<filter>
<filter-name>filterChainProxy</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>filterChainProxy</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Solution 1:[1]
It turns out that I need the following in my application.properties file.
# Allow bean definition override
spring.main.allow-bean-definition-overriding=true
Solution 2:[2]
i used this in my application but unfortunately it is not working. Was it fixed the problem for you?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Waqqas Sharif |
| Solution 2 | Amar J.L |
