본문 바로가기
Tips/Errors

[IntelliJ][Spring]Cannot resolve reference to bean 'cacheManager'

by 오늘의개발부 2019. 7. 12.
반응형

평소처럼 테스트용 스프링 웹 프로젝트를 만들었는데 서버를 돌리니까 다음과 같은 오류가 발생했다.

[org.springframework.beans.factory.BeanCreationException:](org.springframework.beans.factory.BeanCreationException:) Error creating bean with name '[org.springframework.cache.interceptor.CacheInterceptor#0':](org.springframework.cache.interceptor.CacheInterceptor#0':) Cannot resolve reference to bean 'cacheManager' while setting bean property 'cacheManager'; nested exception is [org.springframework.beans.factory.NoSuchBeanDefinitionException:](org.springframework.beans.factory.NoSuchBeanDefinitionException:) No bean named 'cacheManager' available  

실제로는 이 밑으로도 오류가 쭉쭉 있다. 근데 엥? 웬 cacheManager? 난 이런 빈 사용하려고 한 적이 없는데? 기본으로 포함되는 빈인데 어디서 내가 뭘 잘못 해놨나?

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/++cache++ http://www.springframework.org/schema/cache/++spring-cache++.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

그런데 설정파일을 보니 스키마에 웬 cache가 있다. 난 이런 거 넣은 적 없는데... 프로젝트 설정할 때 실수로 뭘 넣었나보다. 어쨌든 스키마 바꿔주고 정상적으로 구동 완료.

추가

문제가 뭐였는고하니, intellij에서 Spring 프로젝트를 만들고 처음 dispatcher-servlet.xml을 설정해줄 때 '<mvc:a'까지만 치면 가장 첫줄 자동완성에 이게 나온다.

<mvc:annotation-driven [http://www.springframework.org/schema/cache](http://www.springframework.org/schema/cache).....  

캐쉬... 자동완성에서 제대로 안 보고 맨 첫줄에 나오길래 내 손으로 추가해버렸던 것이다. 앞으로는 schema/mvc 를 잘 확인하도록 하자.

반응형