Language/Java

JPA Repository Bean 생성 실패 : Not an managed type: class foo.bar

jhbaek 2024. 11. 18. 23:31

프로젝트를 진행하는데, @Entity를 만들고 빌드해서 실행하는데

아무리 해도 계속해서 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AppleRepository': Invocation of init method failed: nested exception is java.lang.illegalArgumentException: Not an managed type: class foo.bar

라면서 진행이 안되었다.

도대체 뭐가 문제일까 하고 수 없이 수정과 빌드를 반복했는데,,,,,

persistence.xml 에 Entity를 등록하지 않은 것이 문제 였다.

회사에 Spring Legacy (Spring JPA)랑 Spring Boot 프로젝트들이 혼재하다보니 차마 persistence.xml 을 볼 생각을 미처 못했다.

거의 2시간 걸려서 트러블슈팅 완료. 세상에 -_-