Spring import runs hibernate persistence twice
        Posted  
        
            by 
                Jaanus
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Jaanus
        
        
        
        Published on 2012-12-11T10:19:15Z
        Indexed on 
            2012/12/11
            11:03 UTC
        
        
        Read the original article
        Hit count: 291
        
I have 2 spring configurations :
spring-servlet.xml
spring-security.xml
needed to add this line to security:
<beans:import resource="spring-servlet.xml"/>
Now hibernate is ran twice, this is log screenshot :

my web.xml:
<servlet>
    <servlet-name>spring</servlet-name>
    <servlet-class>
        org.springframework.web.servlet.DispatcherServlet
    </servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>spring</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>
<listener>
    <listener-class>
        org.springframework.web.context.ContextLoaderListener
      </listener-class>
</listener>
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
        /WEB-INF/spring-security.xml
    </param-value>
</context-param>
© Stack Overflow or respective owner