Package org.springframework.context

Examples of org.springframework.context.ApplicationContext


   
    public void onApplicationEvent(ApplicationEvent applicationEvent)
    {
        if (applicationEvent instanceof ContextRefreshedEvent) {
            ContextRefreshedEvent initEvent = (ContextRefreshedEvent) applicationEvent;
            ApplicationContext context = initEvent.getApplicationContext();
            if (context != null) {
                configureMappings(context.getBeansOfType(Controller.class));
                configureInterceptors(context.getBeansOfType(HandlerInterceptor.class));
                configureRequestHandlers(context);
                configureValidators(context);
            }
        }
    }
View Full Code Here


    }

    public void testSpringIntegration()
            throws Exception
    {
        ApplicationContext appContext = new ClassPathXmlApplicationContext(new String[]{
            "/org/codehaus/xfire/spring/xfire.xml",
            "/org/codehaus/xfire/spring/remoting/exporterTest.xml"});

        assertNotNull(appContext.getBean("xfire.serviceFactory"));
        assertNotNull(appContext.getBean("echo"));
        XFireExporter exporter = (XFireExporter) appContext.getBean("/Echo");
        assertNotNull(exporter);
        BeanNameUrlHandlerMapping handlerMapping = new BeanNameUrlHandlerMapping();
        handlerMapping.setApplicationContext(appContext);
        HttpServletRequest request = getRequest();
View Full Code Here

        extends AbstractXFireSpringTest
{
    public void testServiceFactory()
            throws Exception
    {
        ApplicationContext appContext = getContext();
       
        appContext.getBean("xfire.xmlbeansServiceFactory");
    }
View Full Code Here

        extends AbstractXFireSpringTest
{
    public void testSpringIntegration()
            throws Exception
    {
        ApplicationContext appContext = getContext();
       
        assertNotNull(appContext.getBean("xfire.serviceFactory"));
        assertNotNull(appContext.getBean("echo"));
       
        ServiceBean service = (ServiceBean) appContext.getBean("echoService");
        assertNotNull(service);
       
        assertNotNull(service.getXFireService());
       
        ServiceRegistry reg = (ServiceRegistry) appContext.getBean("xfire.serviceRegistry");
        assertTrue(reg.hasService(service.getXFireService().getSimpleName()));
       
        assertNotNull(service.getInHandlers());
    }
View Full Code Here

   
    public void onApplicationEvent(ApplicationEvent applicationEvent)
    {
        if (applicationEvent instanceof ContextRefreshedEvent) {
            ContextRefreshedEvent initEvent = (ContextRefreshedEvent) applicationEvent;
            ApplicationContext context = initEvent.getApplicationContext();
            if (context != null) {
                configureMappings(context.getBeansOfType(Controller.class));
                configureInterceptors(context.getBeansOfType(HandlerInterceptor.class));
                configureRequestHandlers(context);
                configureValidators(context);
            }
        }
    }
View Full Code Here

   
   
    List<FacetHandler<?>> fConf=null;
   
    Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
    ApplicationContext appCtx=null;
    try{
      appCtx=new FileSystemXmlApplicationContext("file:"+fConfFile.getAbsolutePath());
      fConf =  (List<FacetHandler<?>>)appCtx.getBean("handlers");
    }
    catch(Exception e){
      throw new BuildException(e.getMessage(),e);
    }
   
View Full Code Here

      "classpath:net/sourceforge/squirrel_sql/client/update/gui/installer/event/net.sourceforge.squirrel_sql.client.update.gui.installer.event.applicationContext.xml",
      "classpath:net/sourceforge/squirrel_sql/client/update/gui/installer/util/net.sourceforge.squirrel_sql.client.update.gui.installer.util.applicationContext.xml",
      "classpath:net/sourceforge/squirrel_sql/client/update/util/net.sourceforge.squirrel_sql.client.update.util.applicationContext.xml"
    };
       
    ApplicationContext ctx = new ClassPathXmlApplicationContext(appCtx);
    return (PreLaunchHelper)ctx.getBean(PreLaunchHelper.class.getName());
  }
View Full Code Here

@Test
public class ReconfigProcessorTest {

  public void testGetDefinition() {
    ApplicationContext factory = new ClassPathXmlApplicationContext("/context.xml");
    // two user provider
    assertNotNull((UserDaoProvider) factory.getBean("userDaoProvider"));

    assertNotNull((UserLdapProvider) factory.getBean("userLdapProvider"));

    // userService
    UserService userService = (UserService) factory.getBean("userService");

    assertNotNull(userService);

    assertNotNull(userService.getSomeMap());

    assertEquals(userService.getProvider().getClass(), UserDaoProvider.class);

    // userLdapService
    UserService userLdapService = (UserService) factory.getBean("userLdapService");

    assertNotNull(userLdapService);

    assertEquals(UserLdapProvider.class, userLdapService.getProvider().getClass());
  }
View Full Code Here

    assertEquals(UserLdapProvider.class, userLdapService.getProvider().getClass());
  }

  public void testOverride() {
    ApplicationContext factory = new ClassPathXmlApplicationContext("/context-config.xml");
    // userService
    UserService userService = (UserService) factory.getBean("userService");

    assertNotNull(userService);

    // unmerged map
    assertNotNull(userService.getSomeMap());

    assertEquals(1, userService.getSomeMap().size());

    assertEquals(userService.getSomeMap().get("string"), "override string");

    // merged list
    assertEquals(userService.getSomeList().size(), 3);

    // change class
    UserLdapProvider ldapProvider = (UserLdapProvider) factory.getBean("userLdapProvider");
    assertTrue(ldapProvider instanceof AdvancedUserLdapProvider);

    UserService userLdapService = (UserService) factory.getBean("userLdapService");
    assertNotNull(userLdapService);

    assertEquals(AdvancedUserLdapProvider.class, userLdapService.getProvider().getClass());

  }
View Full Code Here

public class AutoConfigProcessorTest {

  public void testGet() {
    StopWatch watch = new StopWatch();
    watch.start();
    ApplicationContext factory = new ClassPathXmlApplicationContext("/context-auto.xml");
    testBean(factory);
    testFactoryBean(factory);
    System.out.println("config  context-auto completed using " + watch.getTime());
  }
View Full Code Here

TOP

Related Classes of org.springframework.context.ApplicationContext

Copyright © 2018 www.massapicom. 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.