use of example.scannable.ScopedProxyTestBean in project spring-framework by spring-projects.
the class ComponentScanParserScopedProxyTests method testDefaultScopedProxy.
@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();
}
use of example.scannable.ScopedProxyTestBean in project spring-framework by spring-projects.
the class ComponentScanParserScopedProxyTests method testNoScopedProxy.
@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();
}
use of example.scannable.ScopedProxyTestBean in project spring-framework by spring-projects.
the class ComponentScanParserScopedProxyTests method testTargetClassScopedProxy.
@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();
}
Aggregations