Package org.springframework.context.annotation

Examples of org.springframework.context.annotation.AnnotationConfigApplicationContext.refresh()


  @Test
  public void repositoryIsNotTxProxy() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(Config.class);
    ctx.refresh();

    try {
      assertTxProxying(ctx);
      fail("expected exception");
    } catch (AssertionError ex) {
View Full Code Here


  @Test
  public void repositoryIsTxProxy_withDefaultTxManagerName() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(Config.class, DefaultTxManagerNameConfig.class);
    ctx.refresh();

    assertTxProxying(ctx);
  }

  @Test
View Full Code Here

  @Test
  public void repositoryIsTxProxy_withCustomTxManagerName() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(Config.class, CustomTxManagerNameConfig.class);
    ctx.refresh();

    assertTxProxying(ctx);
  }

  @Ignore @Test // TODO SPR-8207
View Full Code Here

  @Ignore @Test // TODO SPR-8207
  public void repositoryIsTxProxy_withNonConventionalTxManagerName_fallsBackToByTypeLookup() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(Config.class, NonConventionalTxManagerNameConfig.class);
    ctx.refresh();

    assertTxProxying(ctx);
  }

  @Test
View Full Code Here

  @Test
  public void repositoryIsClassBasedTxProxy() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(Config.class, ProxyTargetClassTxConfig.class);
    ctx.refresh();

    assertTxProxying(ctx);
    assertThat(AopUtils.isCglibProxy(ctx.getBean(FooRepository.class)), is(true));
  }
View Full Code Here

  @Test
  public void repositoryUsesAspectJAdviceMode() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(Config.class, AspectJTxConfig.class);
    try {
      ctx.refresh();
    }
    catch (Exception ex) {
      // this test is a bit fragile, but gets the job done, proving that an
      // attempt was made to look up the AJ aspect. It's due to classpath issues
      // in .integration-tests that it's not found.
View Full Code Here

  @Test
  public void implicitTxManager() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(ImplicitTxManagerConfig.class);
    ctx.refresh();

    FooRepository fooRepository = ctx.getBean(FooRepository.class);
    fooRepository.findAll();

    CallCountingTransactionManager txManager = ctx.getBean(CallCountingTransactionManager.class);
View Full Code Here

  @Test
  public void explicitTxManager() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(ExplicitTxManagerConfig.class);
    ctx.refresh();

    FooRepository fooRepository = ctx.getBean(FooRepository.class);
    fooRepository.findAll();

    CallCountingTransactionManager txManager1 = ctx.getBean("txManager1", CallCountingTransactionManager.class);
View Full Code Here

  @Test
  public void apcEscalation() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(EnableTxAndCachingConfig.class);
    ctx.refresh();
  }


  @Configuration
  @EnableTransactionManagement
View Full Code Here

  @Test
  public void annotatedServiceWithoutInterface_PTC_true() {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(PTCTrue.class, AnnotatedServiceWithoutInterface.class);
    ctx.refresh();
    AnnotatedServiceWithoutInterface s = ctx.getBean(AnnotatedServiceWithoutInterface.class);
    assertTrue("expected a subclass proxy", AopUtils.isCglibProxy(s));
    assertThat(s, instanceOf(AnnotatedServiceWithoutInterface.class));
  }
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.