Examples of XmlWebApplicationContext


Examples of org.springframework.web.context.support.XmlWebApplicationContext

    private ServletContext servletContext;

    private XmlWebApplicationContext createWebApplicationContext() throws BeansException {

        XmlWebApplicationContext ctx = new XmlWebApplicationContext();
        ctx.setParent(SpringContextSingleton.getInstance().getContext());
        ctx.setServletContext(servletContext);
        servletContext.setAttribute(WebApplicationContext.class.getName() + ".jahiaModules", ctx);
        ctx.setConfigLocation(contextConfigLocation);
        ctx.refresh();

        return ctx;
    }
View Full Code Here

Examples of org.springframework.web.context.support.XmlWebApplicationContext

    }

    public void testWithSpringContext() throws Exception {
       

        ConfigurableWebApplicationContext ac = new XmlWebApplicationContext();
        ServletContext msc = (ServletContext) new MockServletContext();
        msc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ac);
        ac.setServletContext(msc);
        ac.setConfigLocations(new String[] {"org/apache/struts2/spring/StrutsSpringObjectFactoryTest-applicationContext.xml"});
        ac.refresh();
        StrutsSpringObjectFactory fac = new StrutsSpringObjectFactory("constructor", null, msc);

        assertEquals(AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR, fac.getAutowireStrategy());
    }
View Full Code Here

Examples of org.springframework.web.context.support.XmlWebApplicationContext

        StrutsSpringObjectFactory fac = new StrutsSpringObjectFactory();

        // autowire by constructure, we try a non default setting in this unit test
        Settings.set(StrutsConstants.STRUTS_OBJECTFACTORY_SPRING_AUTOWIRE, "constructor");

        ConfigurableWebApplicationContext ac = new XmlWebApplicationContext();
        ServletContext msc = (ServletContext) new MockServletContext();
        msc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ac);
        ac.setServletContext(msc);
        ac.setConfigLocations(new String[] {"org/apache/struts2/spring/StrutsSpringObjectFactoryTest-applicationContext.xml"});
        ac.refresh();

        fac.init(msc);

        assertEquals(AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR, fac.getAutowireStrategy());
    }
View Full Code Here

Examples of org.springframework.web.context.support.XmlWebApplicationContext

      ServletContext servletContext = new MockServletContext(
          "file:src_test/test/org/magicbox/conf");
      String[] paths = { "magicbox-data.xml", "magicbox-service.xml",
          "magicbox-web.xml", "magicbox-servlet.xml",
          "magicbox-security.xml", "magicbox-aop.xml" };
      _xmlWebCtx = new XmlWebApplicationContext();
      _xmlWebCtx.setConfigLocations(paths);
      _xmlWebCtx.setServletContext(servletContext);
      _xmlWebCtx.refresh();
      System.out.println("Start XmlWebApplicationContext");
    }
View Full Code Here

Examples of org.springframework.web.context.support.XmlWebApplicationContext

        final String[] locationArray = locations.toArray(new String[locations.size()]);
        for (int i = 0; i < locationArray.length; i++) {
            locationArray[i] = "classpath:" + locationArray[i];
        }
       
        final XmlWebApplicationContext context = new XmlWebApplicationContext(){
            @Override
            public String[] getConfigLocations() {
                return locationArray;
            }
        };
        context.setServletContext(new AttributeServletContext());
        context.refresh();
        return context;
    }
View Full Code Here

Examples of org.springframework.web.context.support.XmlWebApplicationContext

 
  private ConfigurableWebApplicationContext wac;

  public void setUp() throws Exception {
    MockServletContext sc = new MockServletContext("");
    wac = new XmlWebApplicationContext();
    wac.setServletContext(sc);
    wac.setConfigLocations(new String[] {CONF});
    wac.refresh();
  }
View Full Code Here

Examples of org.springframework.web.context.support.XmlWebApplicationContext

  private ConfigurableWebApplicationContext root;

  private MessageSource themeMsgSource;

  protected ConfigurableApplicationContext createContext() throws Exception {
    root = new XmlWebApplicationContext();
    MockServletContext sc = new MockServletContext();
    root.setServletContext(sc);
    root.setConfigLocations(new String[] {"/org/springframework/web/context/WEB-INF/applicationContext.xml"});
    root.refresh();

    ConfigurableWebApplicationContext wac = new XmlWebApplicationContext();
    wac.setParent(root);
    wac.setServletContext(sc);
    wac.setNamespace("test-servlet");
    wac.setConfigLocations(new String[] {"/org/springframework/web/context/WEB-INF/test-servlet.xml"});
    wac.refresh();

    Theme theme = ((ThemeSource) wac).getTheme(AbstractThemeResolver.ORIGINAL_DEFAULT_THEME_NAME);
    assertNotNull(theme);
    assertTrue("Theme name has to be the default theme name", AbstractThemeResolver.ORIGINAL_DEFAULT_THEME_NAME.equals(theme.getName()));
    themeMsgSource = theme.getMessageSource();
View Full Code Here

Examples of org.springframework.web.context.support.XmlWebApplicationContext

  private HandlerMapping hm;

  public void setUp() throws Exception {
    MockServletContext sc = new MockServletContext("");
    this.wac = new XmlWebApplicationContext();
    this.wac.setServletContext(sc);
    this.wac.setConfigLocations(new String[] {LOCATION});
    this.wac.refresh();
    this.hm = (HandlerMapping) this.wac.getBean("mapping");
  }
View Full Code Here

Examples of org.springframework.web.context.support.XmlWebApplicationContext

  private HandlerMapping hm4;

  public void setUp() throws Exception {
    MockServletContext sc = new MockServletContext("");
    this.wac = new XmlWebApplicationContext();
    this.wac.setServletContext(sc);
    this.wac.setConfigLocations(new String[] {LOCATION});
    this.wac.refresh();
    this.hm = (HandlerMapping) this.wac.getBean("mapping");
    this.hm2 = (HandlerMapping) this.wac.getBean("mapping2");
View Full Code Here

Examples of org.springframework.web.context.support.XmlWebApplicationContext

  private ConfigurableWebApplicationContext wac;

  public void setUp() throws Exception {
    MockServletContext sc = new MockServletContext("");
    wac = new XmlWebApplicationContext();
    wac.setServletContext(sc);
    wac.setConfigLocations(new String[] {CONF});
    wac.refresh();
    hm = (HandlerMapping) wac.getBean("urlMapping");
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.