강의

멘토링

커뮤니티

Inflearn Community Q&A

philipwq39632868's profile image
philipwq39632868

asked

Spring Security

Unable to evaluate the expression Method threw 'org.hibernate.LazyInitializationException' exception. 이라는 에러가 뜹니다.

Written on

·

1K

0

UserDetailsService에서 findByUsername에서 UserRole을 Loading 할 때 lazyloading에 관련하여서 Error가 뜹니다.

https://github.com/JeongJin984/SpringSecurity/blob/master/SpringSecurity2/src/main/java/com/example/SpringSecurity2/Security/service/CustomUserDetailsService.java

코드 입니다.

spring-bootSpring Securityjava

Answer 2

0

leaven님의 프로필 이미지
leaven
Instructor

해당 오류는 JPA 관련 내용이라 자세히 설명 드리지 못하는 점 양해 부탁드립니다

보통 Lazy 는 프록시 및 영속성과 관련된 오류일 가능성이 높으니 찾아보시는 것도 좋을 것 같습니다

0

JJ NAM님의 프로필 이미지
JJ NAM
Questioner

Account.java를 EAGER로 바꾸고 Role.java의 toString exclude를 accounts 로 바꾸면 되기는 됩니다

philipwq39632868's profile image
philipwq39632868

asked

Ask a question