Package org.springframework.web.context.support

Examples of org.springframework.web.context.support.XmlWebApplicationContext.refresh()


        } else {
            ctx2.setConfigLocations(new String[] {"classpath:/META-INF/cxf/cxf.xml",
                                                  location});
            createdContext = ctx2;
        }
        ctx2.refresh();
        return ctx2;
    }
    public void destroyBus() {
        if (busCreated) {
            //if we created the Bus, we need to destroy it.  Otherwise, spring will handleit.
View Full Code Here


        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;
    }

    public void reload() {
View Full Code Here

        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

        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

            public String[] getConfigLocations() {
                return locationArray;
            }
        };
        context.setServletContext(new AttributeServletContext());
        context.refresh();
        return context;
    }
   
}
View Full Code Here

    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

  private ApplicationContext context;

  public void setUp() {
    XmlWebApplicationContext wac = new XmlWebApplicationContext();
    wac.setConfigLocations(new String[] {"classpath:org/springframework/aop/config/aopNamespaceHandlerScopeTests.xml"});
    wac.refresh();
    this.context = wac;
  }

  public void testRequestScoping() throws Exception {
    MockHttpServletRequest oldRequest = new MockHttpServletRequest();
View Full Code Here

  public void testHandlerBeanNotFound() throws Exception {
    MockServletContext sc = new MockServletContext("");
    XmlWebApplicationContext root = new XmlWebApplicationContext();
    root.setServletContext(sc);
    root.setConfigLocations(new String[] {"/org/springframework/web/servlet/handler/map1.xml"});
    root.refresh();
    XmlWebApplicationContext wac = new XmlWebApplicationContext();
    wac.setParent(root);
    wac.setServletContext(sc);
    wac.setNamespace("map2err");
    wac.setConfigLocations(new String[] {"/org/springframework/web/servlet/handler/map2err.xml"});
View Full Code Here

    wac.setParent(root);
    wac.setServletContext(sc);
    wac.setNamespace("map2err");
    wac.setConfigLocations(new String[] {"/org/springframework/web/servlet/handler/map2err.xml"});
    try {
      wac.refresh();
      fail("Should have thrown NoSuchBeanDefinitionException");
    }
    catch (FatalBeanException ex) {
      NoSuchBeanDefinitionException nestedEx = (NoSuchBeanDefinitionException) ex.getCause();
      assertEquals("mainControlle", nestedEx.getBeanName());
View Full Code Here

  private void checkMappings(String beanName) throws Exception {
    MockServletContext sc = new MockServletContext("");
    XmlWebApplicationContext wac = new XmlWebApplicationContext();
    wac.setServletContext(sc);
    wac.setConfigLocations(new String[] {"/org/springframework/web/servlet/handler/map2.xml"});
    wac.refresh();
    Object bean = wac.getBean("mainController");
    Object otherBean = wac.getBean("otherController");
    Object defaultBean = wac.getBean("starController");
    HandlerMapping hm = (HandlerMapping) wac.getBean(beanName);
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.