在搭建微服务的过程中,发现控制台一直在报这个警告日志。本着研究的目的,查看了下源码
[WARN][JpaBaseConfiguration$JpaWebConfiguration][219]: 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
@Bean
public OpenEntityManagerInViewInterceptor openEntityManagerInViewInterceptor() {
if (this.jpaProperties.getOpenInView() == null) {
logger.warn("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");
}
return new OpenEntityManagerInViewInterceptor();
}
因此,只需要设置open_in_view设置初始值即可:
spring:
jpa:
open-in-view: false
这样启动就不会报告警了。
新建公众号:随风的java开发人生 共同进步。
标签:jpa,spring,rendering,warning,open,view From: https://www.cnblogs.com/dajiangyang/p/16768359.html