example.scannable.ScopedProxyTestBean Java Examples
The following examples show how to use
example.scannable.ScopedProxyTestBean.
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: ComponentScanParserScopedProxyTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void testTargetClassScopedProxy() throws Exception { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/context/annotation/scopedProxyTargetClassTests.xml"); context.getBeanFactory().registerScope("myScope", new SimpleMapScope()); ScopedProxyTestBean bean = (ScopedProxyTestBean) context.getBean("scopedProxyTestBean"); // should be a class-based proxy assertTrue(AopUtils.isCglibProxy(bean)); // test serializability assertEquals("bar", bean.foo(1)); ScopedProxyTestBean deserialized = (ScopedProxyTestBean) SerializationTestUtils.serializeAndDeserialize(bean); assertNotNull(deserialized); assertEquals("bar", deserialized.foo(1)); context.close(); }
Example #2
Source File: ComponentScanParserScopedProxyTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void testTargetClassScopedProxy() throws Exception { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/context/annotation/scopedProxyTargetClassTests.xml"); context.getBeanFactory().registerScope("myScope", new SimpleMapScope()); ScopedProxyTestBean bean = (ScopedProxyTestBean) context.getBean("scopedProxyTestBean"); // should be a class-based proxy assertTrue(AopUtils.isCglibProxy(bean)); // test serializability assertEquals("bar", bean.foo(1)); ScopedProxyTestBean deserialized = (ScopedProxyTestBean) SerializationTestUtils.serializeAndDeserialize(bean); assertNotNull(deserialized); assertEquals("bar", deserialized.foo(1)); context.close(); }
Example #3
Source File: ComponentScanParserScopedProxyTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testDefaultScopedProxy() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/context/annotation/scopedProxyDefaultTests.xml"); context.getBeanFactory().registerScope("myScope", new SimpleMapScope()); ScopedProxyTestBean bean = (ScopedProxyTestBean) context.getBean("scopedProxyTestBean"); // should not be a proxy assertFalse(AopUtils.isAopProxy(bean)); context.close(); }
Example #4
Source File: ComponentScanParserScopedProxyTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testNoScopedProxy() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/context/annotation/scopedProxyNoTests.xml"); context.getBeanFactory().registerScope("myScope", new SimpleMapScope()); ScopedProxyTestBean bean = (ScopedProxyTestBean) context.getBean("scopedProxyTestBean"); // should not be a proxy assertFalse(AopUtils.isAopProxy(bean)); context.close(); }
Example #5
Source File: ClassPathScanningCandidateComponentProviderTests.java From spring-analysis-note with MIT License | 5 votes |
private void testCustomAssignableTypeIncludeFilter(ClassPathScanningCandidateComponentProvider provider, Class<? extends BeanDefinition> expectedBeanDefinitionType) { provider.addIncludeFilter(new AssignableTypeFilter(FooService.class)); Set<BeanDefinition> candidates = provider.findCandidateComponents(TEST_BASE_PACKAGE); // Interfaces/Abstract class are filtered out automatically. assertTrue(containsBeanClass(candidates, AutowiredQualifierFooService.class)); assertTrue(containsBeanClass(candidates, FooServiceImpl.class)); assertTrue(containsBeanClass(candidates, ScopedProxyTestBean.class)); assertEquals(3, candidates.size()); assertBeanDefinitionType(candidates, expectedBeanDefinitionType); }
Example #6
Source File: ComponentScanParserScopedProxyTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void testDefaultScopedProxy() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/context/annotation/scopedProxyDefaultTests.xml"); context.getBeanFactory().registerScope("myScope", new SimpleMapScope()); ScopedProxyTestBean bean = (ScopedProxyTestBean) context.getBean("scopedProxyTestBean"); // should not be a proxy assertFalse(AopUtils.isAopProxy(bean)); context.close(); }
Example #7
Source File: ComponentScanParserScopedProxyTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void testNoScopedProxy() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/context/annotation/scopedProxyNoTests.xml"); context.getBeanFactory().registerScope("myScope", new SimpleMapScope()); ScopedProxyTestBean bean = (ScopedProxyTestBean) context.getBean("scopedProxyTestBean"); // should not be a proxy assertFalse(AopUtils.isAopProxy(bean)); context.close(); }
Example #8
Source File: ClassPathScanningCandidateComponentProviderTests.java From java-technology-stack with MIT License | 5 votes |
private void testCustomAssignableTypeIncludeFilter(ClassPathScanningCandidateComponentProvider provider, Class<? extends BeanDefinition> expectedBeanDefinitionType) { provider.addIncludeFilter(new AssignableTypeFilter(FooService.class)); Set<BeanDefinition> candidates = provider.findCandidateComponents(TEST_BASE_PACKAGE); // Interfaces/Abstract class are filtered out automatically. assertTrue(containsBeanClass(candidates, AutowiredQualifierFooService.class)); assertTrue(containsBeanClass(candidates, FooServiceImpl.class)); assertTrue(containsBeanClass(candidates, ScopedProxyTestBean.class)); assertEquals(3, candidates.size()); assertBeanDefinitionType(candidates, expectedBeanDefinitionType); }
Example #9
Source File: ComponentScanParserScopedProxyTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testDefaultScopedProxy() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/context/annotation/scopedProxyDefaultTests.xml"); context.getBeanFactory().registerScope("myScope", new SimpleMapScope()); ScopedProxyTestBean bean = (ScopedProxyTestBean) context.getBean("scopedProxyTestBean"); // should not be a proxy assertFalse(AopUtils.isAopProxy(bean)); context.close(); }
Example #10
Source File: ComponentScanParserScopedProxyTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testNoScopedProxy() { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/context/annotation/scopedProxyNoTests.xml"); context.getBeanFactory().registerScope("myScope", new SimpleMapScope()); ScopedProxyTestBean bean = (ScopedProxyTestBean) context.getBean("scopedProxyTestBean"); // should not be a proxy assertFalse(AopUtils.isAopProxy(bean)); context.close(); }
Example #11
Source File: ComponentScanParserScopedProxyTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void testTargetClassScopedProxy() throws Exception { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/context/annotation/scopedProxyTargetClassTests.xml"); context.getBeanFactory().registerScope("myScope", new SimpleMapScope()); ScopedProxyTestBean bean = (ScopedProxyTestBean) context.getBean("scopedProxyTestBean"); // should be a class-based proxy assertTrue(AopUtils.isCglibProxy(bean)); // test serializability assertEquals("bar", bean.foo(1)); ScopedProxyTestBean deserialized = (ScopedProxyTestBean) SerializationTestUtils.serializeAndDeserialize(bean); assertNotNull(deserialized); assertEquals("bar", deserialized.foo(1)); context.close(); }