springboot 整合hibernate 如何处理延迟加载问题
你使用Spring Boot但是没有使用Spring JPA?而是自己整合的Hibernate?
那么或许你可以尝试添加添加OpenSessionInViewInterceptor即可。
@SpringBootApplication public class WebsiteApplication { public static void main(String[] args) { SpringApplication.run(WebsiteApplication.class, args); } @Bean public OpenSessionInViewInterceptor openSessionInViewInterceptor() { OpenSessionInViewInterceptor interceptor = new OpenSessionInViewInterceptor(); interceptor.setSessionFactory(sessionFactory()); return interceptor; } }