简体   繁体   English

如何在 Spring 而不是 Spring 引导中配置 OSIV?

[英]How can I configure OSIV in Spring, not Spring boot?

Spring boot knows that 'true' value is entered by default if OSIV is not configured. Spring 引导知道如果未配置 OSIV,则默认输入“真”值。

So, is OSIV true by default in Spring mvc projects?那么,在 Spring mvc 项目中,OSIV 是否默认为真? is it false?是假的吗? Also, how can I set it up?另外,我该如何设置?

Below is what it looks like when I configure OSIV in my spring boot project in application.yml.下面是我在 application.yml 的 spring 引导项目中配置 OSIV 时的样子。

jpa:
    open-in-view: true

And next, this is how it looks when I configure jpa in my spring project in context.xml.接下来,这是我在 context.xml 的 spring 项目中配置 jpa 时的样子。

<bean id ="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="jpaProperties">
            <props>
                <prop key="jpa.open-in-view">true</prop> //I thought to set it up like this, but it doesn't work, and I couldn't find any official documentation for the setup.
            </props>
    </property>
</bean>

in my web.xml setting bellow在我的 web.xml 设置中

<filter>
    <filter-name>OpenEntityManagerInViewFilter</filter-name>
    <filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
</filter>
        
<filter-mapping>
    <filter-name>OpenEntityManagerInViewFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用spring boot配置rancher mongodb集群? - How can I configure rancher mongodb cluster with spring boot? 如何在spring boot中的嵌入式tomcat中配置conditionUnless? - How can I configure conditionUnless in embedded tomcat within spring boot? 如何在 Spring boot 中配置拦截器? - How to configure interceptor in Spring boot? 如何使用Spring Boot配置休眠 - how to configure hibernate with spring boot 如何配置 Spring Boot 应用程序以使用两个消息属性文件? - How can I configure a Spring Boot app to use two message properties files? 如何在 MySQL 和 MariaDB 中的 spring 启动应用程序中配置多个(两个以上)数据源, - How can I configure multiple(more than two) data sources in my spring boot application in MySQL and MariaDB, 如何为 spring 启动项目配置 spring 安全性 - how to configure spring security for spring boot project 我如何自动配置Spring Boot来创建2个不同的activeMQ连接工厂和JMSTemplates? - How can i auto configure Spring boot to create 2 different activeMQ connection factories and JMSTemplates? 如何在春季启动中为Webjar配置缓存控制 - How do I configure cache-control for webjars in spring boot 如何使用Spring Boot + Thymeleaf配置国际化? - How do I configure internationalization with Spring Boot + Thymeleaf?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM