Package org.springframework.context.support

Examples of org.springframework.context.support.GenericXmlApplicationContext


  private GenericXmlApplicationContext ctx;

  @Before
  public void setUp() {
    ctx = new GenericXmlApplicationContext("/org/springframework/data/keyvalue/redis/config/namespace.xml");
  }
View Full Code Here


*/
public class ContainerXmlSetupTest {

  @Test
  public void testContainerSetup() throws Exception {
    GenericXmlApplicationContext ctx = new GenericXmlApplicationContext(
        "/org/springframework/data/keyvalue/redis/listener/container.xml");
    RedisMessageListenerContainer container = ctx.getBean("redisContainer", RedisMessageListenerContainer.class);
    assertTrue(container.isRunning());
  }
View Full Code Here

public class AspectJAnnotationTests extends AbstractAnnotationTests {


  @Override
  protected ConfigurableApplicationContext getApplicationContext() {
    return new GenericXmlApplicationContext("/org/springframework/cache/config/annotation-cache-aspectj.xml");
  }
View Full Code Here

*/
public class JCacheAspectJNamespaceConfigTests extends AbstractJCacheAnnotationTests {

  @Override
  protected ApplicationContext getApplicationContext() {
    return new GenericXmlApplicationContext(
        "/org/springframework/cache/config/annotation-jcache-aspectj.xml");
  }
View Full Code Here

*/
public class JCacheNamespaceDrivenTests extends AbstractJCacheAnnotationTests {

  @Override
  protected ApplicationContext getApplicationContext() {
    return new GenericXmlApplicationContext(
        "/org/springframework/cache/jcache/config/jCacheNamespaceDriven.xml");
  }
View Full Code Here

        "/org/springframework/cache/jcache/config/jCacheNamespaceDriven.xml");
  }

  @Test
  public void cacheResolver() {
    ConfigurableApplicationContext context = new GenericXmlApplicationContext(
        "/org/springframework/cache/jcache/config/jCacheNamespaceDriven-resolver.xml");

    DefaultJCacheOperationSource ci = context.getBean(DefaultJCacheOperationSource.class);
    assertSame(context.getBean("cacheResolver"), ci.getCacheResolver());
    context.close();
  }
View Full Code Here

*/
public class JCacheStandaloneConfigTests extends AbstractJCacheAnnotationTests {

  @Override
  protected ApplicationContext getApplicationContext() {
    return new GenericXmlApplicationContext(
        "/org/springframework/cache/jcache/config/jCacheStandaloneConfig.xml");
  }
View Full Code Here

  @Test
  public void testMBeanExporters() throws Exception {
    String base = "/META-INF/spring/batch/";
    String bootstrap = base + "bootstrap/";
    new GenericXmlApplicationContext( //
        bootstrap + "manager/execution-context.xml", //
        bootstrap + "manager/jmx-context.xml", //
        bootstrap + "manager/env-context.xml", //
        bootstrap + "manager/data-source-context.xml", //
        bootstrap + "integration/jmx-context.xml" //
View Full Code Here

            + "\nhttps://github.com/SpringSource/spring-integration-extensions"
            + "\n                                                         "
            + "\n=========================================================" );
    }

    final GenericXmlApplicationContext context = new GenericXmlApplicationContext();

    System.out.println("Please enter the: ");
    System.out.println("\t- SMB Host");
    System.out.println("\t- SMB Share and Directory");
    System.out.println("\t- SMB Username");
    System.out.println("\t- SMB Password");

    System.out.print("Host: ");
    final String host = scanner.nextLine();

    System.out.print("Share and Directory (e.g. myFile/path/to/): ");
    final String shareAndDir = scanner.nextLine();

    System.out.print("Username (e.g. guest): ");
    final String username = scanner.nextLine();

    System.out.print("Password (can be empty): ");
    final String password = scanner.nextLine();

    context.getEnvironment().getSystemProperties().put("host", host);
    context.getEnvironment().getSystemProperties().put("shareAndDir", shareAndDir);
    context.getEnvironment().getSystemProperties().put("username", username);
    context.getEnvironment().getSystemProperties().put("password", password);

    context.load("classpath:META-INF/spring/integration/*-context.xml");
    context.registerShutdownHook();
    context.refresh();

    context.registerShutdownHook();

    if (LOGGER.isInfoEnabled()) {
      LOGGER.info("\n========================================================="
            + "\n                                                         "
            + "\n    Please press 'q + Enter' to quit the application.    "
            + "\n                                                         "
            + "\n=========================================================" );
    }

    SmbSessionFactory smbSessionFactory = context.getBean("smbSession", SmbSessionFactory.class);

    System.out.println("Polling from Share: " + smbSessionFactory.getUrl());

    while (true) {

View Full Code Here

        + "\n"
        + "\n    For more information please visit:                   "
        + "\n    http://www.springsource.org/spring-integration       "
        + "\n" + HORIZONTAL_LINE);

    final GenericXmlApplicationContext context = new GenericXmlApplicationContext();
    final ConfigurableEnvironment environment = context.getEnvironment();

    final String fromEmailAddress;
    final String toEmailAddress;
    final String subject;
    final String body;

    System.out.print("\nFrom which email address would you like to send a message?: ");
    fromEmailAddress = scanner.nextLine();

    System.out.print("To which email address would you like to send a message?: ");
    toEmailAddress = scanner.nextLine();

    System.out.print("What is the subject line?: ");
    subject = scanner.nextLine();

    System.out.print("What is the body of the message?: ");
    body = scanner.nextLine();

    if (!environment.containsProperty("accessKey")) {
      System.out.print("Please enter your access key: ");
      final String accessKey = scanner.nextLine();
      environment.getSystemProperties().put("accessKey", accessKey);
    }

    if (!environment.containsProperty("secretKey")) {
      System.out.print("Please enter your secret key: ");
      final String secretKey = scanner.nextLine();
      environment.getSystemProperties().put("secretKey", secretKey);
    }

    context.load("classpath:META-INF/spring/integration/*-context.xml");
    context.registerShutdownHook();
    context.refresh();

    final EmailService emailService = context.getBean(EmailService.class);

    emailService.send(fromEmailAddress, toEmailAddress, subject, body);

    System.out.println(String.format("The email to '%s' was sent successfully.", toEmailAddress));

View Full Code Here

TOP

Related Classes of org.springframework.context.support.GenericXmlApplicationContext

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.