Examples of InitDestroyAnnotationBeanPostProcessor


Examples of org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor

    assertTrue(bean.destroyCalled);
  }

  public void testPostConstructAndPreDestroyWithManualConfiguration() {
    DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
    InitDestroyAnnotationBeanPostProcessor bpp = new InitDestroyAnnotationBeanPostProcessor();
    bpp.setInitAnnotationType(PostConstruct.class);
    bpp.setDestroyAnnotationType(PreDestroy.class);
    bf.addBeanPostProcessor(bpp);
    bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(AnnotatedInitDestroyBean.class));

    AnnotatedInitDestroyBean bean = (AnnotatedInitDestroyBean) bf.getBean("annotatedBean");
    assertTrue(bean.initCalled);
View Full Code Here

Examples of org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor

    bpp2.postProcessBeforeDestruction(bean, "annotatedBean");
    assertTrue(bean.destroyCalled);
  }

  public void testSerializationWithManualConfiguration() throws Exception {
    InitDestroyAnnotationBeanPostProcessor bpp = new InitDestroyAnnotationBeanPostProcessor();
    bpp.setInitAnnotationType(PostConstruct.class);
    bpp.setDestroyAnnotationType(PreDestroy.class);
    InitDestroyAnnotationBeanPostProcessor bpp2 = (InitDestroyAnnotationBeanPostProcessor)
        SerializationTestUtils.serializeAndDeserialize(bpp);

    AnnotatedInitDestroyBean bean = new AnnotatedInitDestroyBean();
    bpp2.postProcessBeforeDestruction(bean, "annotatedBean");
    assertTrue(bean.destroyCalled);
  }
View Full Code Here

Examples of org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor

  }

  @Test
  public void testPostConstructAndPreDestroyWithManualConfiguration() {
    DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
    InitDestroyAnnotationBeanPostProcessor bpp = new InitDestroyAnnotationBeanPostProcessor();
    bpp.setInitAnnotationType(PostConstruct.class);
    bpp.setDestroyAnnotationType(PreDestroy.class);
    bf.addBeanPostProcessor(bpp);
    bf.registerBeanDefinition("annotatedBean", new RootBeanDefinition(AnnotatedInitDestroyBean.class));

    AnnotatedInitDestroyBean bean = (AnnotatedInitDestroyBean) bf.getBean("annotatedBean");
    assertTrue(bean.initCalled);
View Full Code Here

Examples of org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor

    assertTrue(bean.destroyCalled);
  }

  @Test
  public void testSerializationWithManualConfiguration() throws Exception {
    InitDestroyAnnotationBeanPostProcessor bpp = new InitDestroyAnnotationBeanPostProcessor();
    bpp.setInitAnnotationType(PostConstruct.class);
    bpp.setDestroyAnnotationType(PreDestroy.class);
    InitDestroyAnnotationBeanPostProcessor bpp2 = (InitDestroyAnnotationBeanPostProcessor)
        SerializationTestUtils.serializeAndDeserialize(bpp);

    AnnotatedInitDestroyBean bean = new AnnotatedInitDestroyBean();
    bpp2.postProcessBeforeDestruction(bean, "annotatedBean");
    assertTrue(bean.destroyCalled);
  }
View Full Code Here

Examples of org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor

        configurationProcessor.setBeanFactory(factory);
        configurationProcessor.setConfigurationProvider(confProvider);
        configurationProcessor.setOrder(2);
        factory.addBeanPostProcessor(configurationProcessor);
       
        InitDestroyAnnotationBeanPostProcessor annotationProcessor = new InitDestroyAnnotationBeanPostProcessor();
        annotationProcessor.setInitAnnotationType(PostConstruct.class);
        annotationProcessor.setDestroyAnnotationType(PreDestroy.class);
        factory.addBeanPostProcessor(annotationProcessor);


    }
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.