개인 프로젝트

[WARN] spring.jpa.open-in-view

오마이냥 2024. 7. 24. 23:17

WARN 18488 --- [backend] [           main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning

 

 

스프링 부트로 프로젝트를 만들고 실행하면 WARN이 하나 발생한다..

 

open-in-view는 JPA에서 제공하는 기능 중 하나로

open-in-view=false일 경우 트랜잭션을 종료할 때 영속성 컨텍스트 또한 닫히게 된다.

open-in-view=true일 경우 트랜잭션이 완수 돼도 영속성 컨텍스트는 살아있다. 

 

참고: https://velog.io/@dnwlsrla40/JPA-Open-In-View

 

당장 내 프로젝트에선 Lazy Loading이 필요하지 않으니 false로 설정해 WARN을 없앴다.