Package org.springframework.context.support

Examples of org.springframework.context.support.GenericXmlApplicationContext


public class ServiceInjectionTests {

  @Test
  public void testServiceInjection() {
    new GenericXmlApplicationContext("/application-context.xml");

    // Entity should now be enhanced
    Entity entity = new Entity();
    assertThat("service was not injected into @Configurable entity",
        entity.getService(), notNullValue());
View Full Code Here


* occurrs when running from a JUnit @Test method.
*/
public class ServiceInjectionMain {

  public static void main(String... args) {
    new GenericXmlApplicationContext("/application-context.xml");

    // Entity should now be enhanced
    Entity entity = new Entity();
    assertThat("service was not injected into @Configurable entity",
        entity.getService(), notNullValue());
View Full Code Here

*/
public class ReproTests {

  @Test
  public void repro() {
    GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
    ctx.load("classpath:org/springframework/issues/ReproTests-context.xml");
    ctx.refresh();

    Bar bar = ctx.getBean(Bar.class);

    Calendar c = Calendar.getInstance();
    c.clear();
    c.setTimeZone(TimeZone.getTimeZone("UTC"));
    c.set(2009, 5, 1);
View Full Code Here

*/
public class ReproTests {

  @Test
  public void repro() {
    GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
    ctx.load("classpath:org/springframework/issues/ReproTests-context.xml");
    ctx.refresh();

    // First time works
    Bar bar = ctx.getBean(Bar.class);
    bar.getFoo().getProviderClass();

    // Second call crashes
    bar = ctx.getBean(Bar.class);
    bar.getFoo().getProviderClass();
  }
View Full Code Here

*/
public class ReproTests {

  @Test
  public void repro() {
    GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
    ctx.load("classpath:org/springframework/issues/ReproTests-context.xml");
    ctx.refresh();
    File file = ctx.getBean("theFile", File.class);
    assertTrue(file.exists());
  }
View Full Code Here

      executor.shutdownNow();
    }
  }

  private void reproOnce(int threads) throws Exception {
    GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
    ctx.load("classpath:org/springframework/issues/ReproTests-context.xml");
    ctx.refresh();

    List<Foo> foos = getFoos(ctx, threads);
    for (Foo foo : foos) {
      assertThat(foo.getBar(), CoreMatchers.notNullValue());
    }
View Full Code Here

*/
public class ReproTests {

  @Test
  public void repro() {
    GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
    ctx.load("classpath:org/springframework/issues/ReproTests-context.xml");
    ctx.refresh();

    Foo foo = ctx.getBean(Foo.class);

    assertThat(foo.isMogoSlaveOk(), equalTo(true));
  }
View Full Code Here

  }

  @Test
  public void xmlCentric() {

    GenericApplicationContext appContext = new GenericXmlApplicationContext(
        "classpath:org/springframework/issues/config/xml_centric/app-config.xml");

    TestService service = appContext.getBean(TestService.class);
    assertThat(service.queryDummyValue(), equalTo(12345));
    appContext.close();
  }
View Full Code Here

  private TransferService transferService;

  @Before
  public void setUp() {
    ApplicationContext ctx =
      new GenericXmlApplicationContext("com/bank/config/app-config.xml");


    this.transferService = ctx.getBean(TransferService.class);
    this.jdbcTemplate = new JdbcTemplate(ctx.getBean(DataSource.class));
  }
View Full Code Here

  private TransferService transferService;

  @Before
  public void setUp() {
    ApplicationContext ctx =
      new GenericXmlApplicationContext("com/bank/config/app-config.xml");


    this.transferService = ctx.getBean(TransferService.class);
    this.jdbcTemplate = new JdbcTemplate(ctx.getBean(DataSource.class));
  }
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.