Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-2006

StrutsSpringObjectFactory should create a child Spring ApplicationContext

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Won't Fix
    • 2.0.8
    • None
    • Plugin - Mechanism
    • None
    • spring 2.0.6

    Description

      org.apache.struts2.spring.StrutsSpringObjectFactory

      use root WebApplicationContext now :
      .....
      boolean useClassCache = "true".equals(useClassCacheStr);
      log.info("Initializing Struts-Spring integration...");
      org.springframework.context.ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(servletContext);
      .....

      i think it's better to create a child ApplicationContext, it will be more clearly and it can use specific config( add a constant in struts.xml )
      like spring mvc do now:

      org.springframework.web.servlet.FrameworkServlet

      ConfigurableWebApplicationContext wac = (ConfigurableWebApplicationContext) BeanUtils.instantiateClass(getContextClass());
      wac.setParent(parent);
      wac.setServletContext(getServletContext());
      wac.setServletConfig(getServletConfig());
      wac.setNamespace(getNamespace());
      if (getContextConfigLocation() != null) {
      wac.setConfigLocations(
      StringUtils.tokenizeToStringArray(
      getContextConfigLocation(), ConfigurableWebApplicationContext.CONFIG_LOCATION_DELIMITERS));
      }
      wac.refresh();

      Attachments

        Activity

          People

            lukaszlenart Lukasz Lenart
            ssmax MaxGao
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: