본문 바로가기
Framework/Spring

BeanCreationException 에러 해결방법

by 나비와꽃기린 2018. 12. 12.
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.



다음과 같은 Spring BeanCreationException 에러가 났다.


(1)

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'menuController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factoy.BeanNotOfRequiredTypeException: Bean named 'boardService' must be of type [com.penta.epplt.app.service.MenuService], but was actually of type [com.penta.epplt.app.service.BoardService]



(2)

Caused By: org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'boardService' must be of type [com.penta.epplt.app.service.MenuService], but was actually of type [com.penta.eplt.app.service.BoardService]





bean생성이 안 됬다는 에러인데

boardService 이름의 빈이 MenuService에 

인젝션되어 디펜던시가 되지 않았다는 것.

(즉 서비스명이 일치하지 않아서 발생한 에러)






▲ MenuService class가

boardService라는 이름으로 인젝션되어있었다..






▲ 알맞게 고쳐준 예





해결 끝

간단한 에러였다.