spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during

在搭建微服务的过程中,发现控制台一直在报这个警告日志。本着研究的目的,查看了下源码

[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开发人生 共同进步。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值