반응형
[Spring] NoSuchBeanDefinitionException: No bean named 'springSecurityFilterChain' is defined 오류 해결
전자정부 프레임워크 Spring (Maven) Project를 구동하였더니 발생한 에러였다.
심각: Exception starting filter springSecurityFilterChain
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'springSecurityFilterChain' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:641)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1157)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:280)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:981)
at org.springframework.web.filter.DelegatingFilterProxy.initDelegate(DelegatingFilterProxy.java:324)
at org.springframework.web.filter.DelegatingFilterProxy.initFilterBean(DelegatingFilterProxy.java:235)
at org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:199)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:285)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:266) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4708)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5348) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)
이는 web.xml 에서 SpringSecurityFilterChain 이 bean으로 생성되기 전에 spring context-security.xml 설정을 먼저 불러와
bean이 생성되기 전에 찾으니 bean을 찾을 수 없다는 에러가 뜬 것입니다.
오류 코드
.
.
.
<!-- context-security.xml 설정파일 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:spring/context-*.xml</param-value>
</context-param>
<!-- 스프링 시큐리티 -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- //스프링 시큐리티 -->
.
.
.
수정 코드
.
.
.
<!-- bean을 먼저 생성 -->
<!-- 스프링 시큐리티 -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- //스프링 시큐리티 -->
<!-- context-security.xml 설정파일 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:spring/context-*.xml</param-value>
</context-param>
.
.
.
참고로 전자정부프레임워크 3.8 버전의 내용이고, 그 전 버전에서는 해당 오류가 나지 않았었다.
728x90
반응형
'JVM > Spring' 카테고리의 다른 글
[Spring] 스프링 properties 설정 파일 분리하기 (0) | 2022.01.26 |
---|---|
[Web] 파일업로드 시 404 에러 (Current request is not of type ) (0) | 2021.12.09 |
[Spring] context-datasource.xml 설정 : DBCP configuration 살펴보기 (0) | 2020.07.06 |
[Error] Class : org.springframework.util.AntPathMatcher not found 에러 (1) | 2019.11.18 |
[Error] Spring 웹 프로젝트 META-INF\MANIFEST.MF (지정된 경로를 찾을 수 없습니다) 에러 해결 (0) | 2019.10.25 |
댓글