Announcement Announcement Module
Collapse
No announcement yet.
web.xml referring to bean defined in a separate utility jar Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • web.xml referring to bean defined in a separate utility jar

    In my web.xml file I'm defining a HibernateOpenSessionInViewFilter, and this bean requires a reference to a HibernateSessionFactory. Now, my session factory has already been defined in a an applicationContext.xml file in a separate EJBServices utility jar which is shared across multiple web apps.

    How can I successfully reference this bean in the utility jar? I've looked into SingletonBeanFactoryLocator, but it seems to require some Java code to set up, and I need this to be done automatically for me in web.xml.

    web.xml code:

    Code:
    <filter>
        <filter-name>hibernateFilter</filter-name>
        <filter-class>
          org.springframework.orm.hibernate.support.OpenSessionInViewFilter
        </filter-class>
        <init-param>
        	<param-name>sessionFactoryBeanName</param-name>
        	<param-value>hibernateSessionFactory</param-value> <!-- defined in app context of separate jar -->
        </init-param>
      </filter>

  • #2
    How can I successfully reference this bean in the utility jar?
    Just load it from the classpath. E.g.
    Code:
    	<context-param>
    	    <!-- See&#58; PathMatchingResourcePatternResolver -->
    		<param-name>contextConfigLocation</param-name>
    		<param-value>
    			classpath*&#58;/applicationContext.xml
    			classpath*&#58;/applicationContext-service.xml
    		</param-value>
    	</context-param>

    Comment


    • #3
      thanks. Now my question is, when I do a getBean() call from my web app code, will that return the same bean instances that are returned when I do a getBean() from my EJBs inside the EJB jar?

      Comment

      Working...
      X