Package org.springframework.context

Examples of org.springframework.context.ConfigurableApplicationContext


*
*/
public class AXML {

  public static void main(String[] args) throws Exception {
    ConfigurableApplicationContext ctx =
        new ClassPathXmlApplicationContext("AXML-context.xml");
    System.out.println(ctx.getBean(FooService.class).foo("foo"));
    ctx.close();
  }
View Full Code Here


  @Autowired
  GMailProperties gmail;

  public static void main(String[] args) throws Exception {
    ConfigurableApplicationContext ctx =
        new SpringApplicationBuilder(GIMAP.class)
            .web(false)
            .run(args);
    System.out.println("Hit Enter to terminate");
    System.in.read();
    ctx.close();
  }
View Full Code Here

*
*/
public class BXMLAndPojo {

  public static void main(String[] args) throws Exception {
    ConfigurableApplicationContext ctx =
        new ClassPathXmlApplicationContext("BXMLAndPojo-context.xml");
    System.out.println(ctx.getBean(FooService.class).foo("foo"));
    ctx.close();
  }
View Full Code Here

@EnableAutoConfiguration
@IntegrationComponentScan
public class EDSL {

  public static void main(String[] args) throws Exception {
    ConfigurableApplicationContext ctx =
        new SpringApplicationBuilder(EDSL.class)
          .web(false)
          .run(args);
    System.out.println(ctx.getBean(FooService.class).foo("foo"));
    ctx.close();
  }
View Full Code Here

  @Autowired
  GMailProperties gmail;

  public static void main(String[] args) throws Exception {
    ConfigurableApplicationContext ctx =
        new SpringApplicationBuilder(FMail.class)
            .web(false)
            .run(args);
    System.out.println(ctx.getBean(FooService.class).foo("foo"));
    ctx.close();
  }
View Full Code Here

*/
public class SpringIntegrationTest {

  public static void main(String[] args) throws Exception {

    ConfigurableApplicationContext context =
        new ClassPathXmlApplicationContext("/META-INF/spring/integration/spring-integration-context.xml", SpringIntegrationTest.class);
    System.out.println("Hit Enter to terminate");
    System.in.read();
    context.close();
  }
View Full Code Here

        out.close();
    }
    logger.info("Populated directory with files");
    Thread.sleep(2000);
    logger.info("Starting Spring Integration Sequential File processing");
    ConfigurableApplicationContext ac = new ClassPathXmlApplicationContext("META-INF/spring/integration/sequentialFileProcessing-config.xml");
    PollableChannel filesOutChannel = ac.getBean("filesOutChannel", PollableChannel.class);
    for (int i = 0; i < fileCount; i++) {
      logger.info("Finished processing " + filesOutChannel.receive(10000).getPayload());
    }
    ac.stop();
  }
View Full Code Here

        out.close();
    }
    logger.info("Populated directory with files");
    Thread.sleep(2000);
    logger.info("Starting Spring Integration Sequential File processing");
    ConfigurableApplicationContext ac = new ClassPathXmlApplicationContext("/META-INF/spring/integration/concurrentFileProcessing-config.xml");
    PollableChannel filesOutChannel = ac.getBean("filesOutChannel", PollableChannel.class);
    for (int i = 0; i < fileCount; i++) {
      logger.info("Finished processing " + filesOutChannel.receive(10000).getPayload());
    }
    ac.stop();
  }
View Full Code Here

@EnableAutoConfiguration(exclude = GroovyTemplateAutoConfiguration.class)
@ImportResource("classpath:org/springframework/integration/samples/chat/stomp/server/stomp-server.xml")
public class Application {

  public static void main(String[] args) throws Exception {
    ConfigurableApplicationContext ctx = SpringApplication.run(Application.class, args);
    System.out.println("Hit 'Enter' to terminate");
    System.in.read();
    ctx.close();
  }
View Full Code Here

  private static ExecutorService executor = Executors.newFixedThreadPool(100);
  private static int timeout = 20;

  @Test
  public void testAsyncGateway() throws Exception{
    ConfigurableApplicationContext ac =
        new FileSystemXmlApplicationContext("src/main/resources/META-INF/spring/integration/*.xml");
    MathServiceGateway mathService = ac.getBean("mathService", MathServiceGateway.class);
    Map<Integer, Future<Integer>> results = new HashMap<Integer, Future<Integer>>();
    Random random = new Random();
    for (int i = 0; i < 100; i++) {
      int number = random.nextInt(200);
      Future<Integer> result = mathService.multiplyByTwo(number);
      results.put(number, result);
    }
    for (final Map.Entry<Integer, Future<Integer>> resultEntry : results.entrySet()) {
      executor.execute(() -> {
        int[] result = processFuture(resultEntry);

        if (result[1] == -1){
          logger.info("Multiplying " + result[0] + " should be easy. You should be able to multiply any number < 100 by 2 in your head");
        } else if (result[1] == -2){
          logger.info("Multiplication of " + result[0] + " by 2 is can not be accomplished in " + timeout + " seconds");
        } else {
          logger.info("Result of multiplication of " + result[0] + " by 2 is " + result[1]);
        }
      });
    }
    executor.shutdown();
    executor.awaitTermination(60, TimeUnit.SECONDS);
    logger.info("Finished");
    ac.close();
  }
View Full Code Here

TOP

Related Classes of org.springframework.context.ConfigurableApplicationContext

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.