Home > Back-end >  How can I configure OSIV in Spring, not Spring boot?
How can I configure OSIV in Spring, not Spring boot?

Time:12-12

Spring boot knows that 'true' value is entered by default if OSIV is not configured.

So, is OSIV true by default in Spring mvc projects? 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.

jpa:
    open-in-view: true

And next, this is how it looks when I configure jpa in my spring project in context.xml.

<bean id ="entityManagerFactory" >
    <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>

CodePudding user response:

in my web.xml setting bellow

<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>
  • Related