Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <bean id="simpleBean" class="org.springframework.aop.framework.ProxyFactoryBean">
- <property name="target">
- <ref local="simpleBeanTarget"/>
- </property>
- <property name="interceptorNames">
- <list>
- <value>cacheInterceptor</value>
- </list>
- </property>
- </bean>
- <bean id="springDao" class="org.springframework.aop.framework.ProxyFactoryBean">
- <property name="target" ref="springDaoTarget"/>
- <property name="interceptorNames">
- <list>
- <value>daoInterceptor</value>
- </list>
- </property>
- </bean>
- public class SpringDao extends JdbcDaoSupport {
- private SimpleJdbcTemplate simpleJdbcTemplate;
- public SimpleJdbcTemplate getSimpleJdbcTemplate() {
- if (simpleJdbcTemplate==null) {
- simpleJdbcTemplate= new SimpleJdbcTemplate(getDataSource());
- }
- return simpleJdbcTemplate;
- }
- ...
- @Autowired
- @Qualifier("springDao")
- protected SpringDao springDao;
- @Autowired
- @Qualifier("springDaoTarget")
- protected SpringCustomerCapacityDao springDao;
- Object proxy = applicationContext.getBean("springDao");
- Assert.assertNotNull(proxy);
- Assert.assertTrue(proxy instanceof SpringDao);
- <bean id="springDaoTarget" class="com.company.SpringDao">
Add Comment
Please, Sign In to add comment