Announcement Announcement Module
Collapse
No announcement yet.
Accessing Beans loaded from struts-config.xml using WebApplicationContext? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Accessing Beans loaded from struts-config.xml using WebApplicationContext?

    All,
    I'm using struts with spring.

    Code:
    <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
    		<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml,/WEB-INF/action-servlet.xml" /> 
    	</plug-in>
    I have a number of beans defined in applicationContext.xml.
    When I try to access these beans using WebApplicationContext, like

    Code:
    WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(servlet.getServletContext());
    manager = (HierarchyInUseManager) ctx.getBean("hierarchyInUseManager");
    i get

    Code:
    org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'hierarchyInUseManager' is defined
    Can I access these beans using WebApplicationContext? If not, how do I do it?

    I understand struts loads it's own context. How can I get access to the struts context?

    Any help appreciated.
    Thanks.
Working...
X