(error)Mock을 이용하여 test하던 중 마주친 에러.

전성영·2022년 6월 2일
0

Error

목록 보기
3/16
Error creating bean with name 'jpaAuditingHandler': 
Cannot resolve reference to bean 'jpaMappingContext'
while setting constructor argument; 
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'jpaMappingContext': 
Invocation of init method failed; 
nested exception is java.lang.IllegalArgumentException:
At least one JPA metamodel must be present!

이 친구가 나왔다. 찾아보니 test중에 데이터베이스를 사용하지 않아서 스프링이 발생시키는 예외라고 한다.

해결방법으로는 .Test에

@MockBean(JpaMetamodelMappingContext.class) 

를 추가해주면 된다.

profile
Slow and Steady

0개의 댓글