Package org.springframework.context.support

Examples of org.springframework.context.support.FileSystemXmlApplicationContext.containsBean()


        } else if (args.length == 2) {
            LOG.info("Using xml configuration file " + args[1] + "...");
            FileSystemXmlApplicationContext ctx = new FileSystemXmlApplicationContext(
                    args[1]);

            if (ctx.containsBean("server")) {
                server = (FtpServer) ctx.getBean("server");
            } else {
                String[] beanNames = ctx.getBeanNamesForType(FtpServer.class);
                if (beanNames.length == 1) {
                    server = (FtpServer) ctx.getBean(beanNames[0]);
View Full Code Here


            System.out.println("Using XML configuration file " + args[0]
                    + "...");
            FileSystemXmlApplicationContext ctx = new FileSystemXmlApplicationContext(
                    args[0]);

            if (ctx.containsBean("server")) {
                server = (FtpServer) ctx.getBean("server");
            } else {
                String[] beanNames = ctx.getBeanNamesForType(FtpServer.class);
                if (beanNames.length == 1) {
                    server = (FtpServer) ctx.getBean(beanNames[0]);
View Full Code Here

        } else if (args.length == 2) {
            LOG.info("Using xml configuration file " + args[1] + "...");
            FileSystemXmlApplicationContext ctx = new FileSystemXmlApplicationContext(
                    args[1]);

            if (ctx.containsBean("server")) {
                server = (FtpServer) ctx.getBean("server");
            } else {
                String[] beanNames = ctx.getBeanNamesForType(FtpServer.class);
                if (beanNames.length == 1) {
                    server = (FtpServer) ctx.getBean(beanNames[0]);
View Full Code Here

            System.out.println("Using XML configuration file " + args[0]
                    + "...");
            FileSystemXmlApplicationContext ctx = new FileSystemXmlApplicationContext(
                    args[0]);

            if (ctx.containsBean("server")) {
                server = (FtpServer) ctx.getBean("server");
            } else {
                String[] beanNames = ctx.getBeanNamesForType(FtpServer.class);
                if (beanNames.length == 1) {
                    server = (FtpServer) ctx.getBean(beanNames[0]);
View Full Code Here

    ctx.setEnvironment(prodEnv);
    ctx.refresh();
    assertEnvironmentBeanRegistered(ctx);
    assertHasEnvironment(ctx, prodEnv);
    assertEnvironmentAwareInvoked(ctx, ctx.getEnvironment());
    assertThat(ctx.containsBean(DEV_BEAN_NAME), is(false));
    assertThat(ctx.containsBean(PROD_BEAN_NAME), is(true));
  }

  @Test
  public void annotationConfigApplicationContext_withPojos() {
View Full Code Here

    ctx.refresh();
    assertEnvironmentBeanRegistered(ctx);
    assertHasEnvironment(ctx, prodEnv);
    assertEnvironmentAwareInvoked(ctx, ctx.getEnvironment());
    assertThat(ctx.containsBean(DEV_BEAN_NAME), is(false));
    assertThat(ctx.containsBean(PROD_BEAN_NAME), is(true));
  }

  @Test
  public void annotationConfigApplicationContext_withPojos() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
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.