Java Code Examples for org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor#setInitAnnotationType()
The following examples show how to use
org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor#setInitAnnotationType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommonAnnotationBeanPostProcessorTests.java From spring-analysis-note with MIT License | 5 votes |
@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); bf.destroySingletons(); assertTrue(bean.destroyCalled); }
Example 2
Source File: CommonAnnotationBeanPostProcessorTests.java From spring-analysis-note with MIT License | 5 votes |
@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); }
Example 3
Source File: CommonAnnotationBeanPostProcessorTests.java From java-technology-stack with MIT License | 5 votes |
@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); bf.destroySingletons(); assertTrue(bean.destroyCalled); }
Example 4
Source File: CommonAnnotationBeanPostProcessorTests.java From java-technology-stack with MIT License | 5 votes |
@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); }
Example 5
Source File: CommonAnnotationBeanPostProcessorTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@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); bf.destroySingletons(); assertTrue(bean.destroyCalled); }
Example 6
Source File: CommonAnnotationBeanPostProcessorTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@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); }