DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Boy has posted 1 posts at DZone. View Full User Profile

ProxyFactoryBean

08.24.2006
| 6757 views |
  • submit to reddit
        Use of spring 's ProxyFactoryBean


  <bean id="abstractDaoTarget"
        class="com.dao.impl.GenericDaoHibernateImpl" abstract="true">
    <property name="sessionFactory">
      <ref bean="sessionFactory"/>
    </property>
  </bean>
  
  <bean id="abstractDao"
        class="org.springframework.aop.framework.ProxyFactoryBean" abstract="true">
    <property name="interceptorNames">
      <list>
        <value>finderIntroductionAdvisor</value>
      </list>
    </property>
  </bean>
  
  <bean id="dao" abstract="true">
    <property name="sessionFactory">
      <ref bean="sessionFactory"/>
    </property>
  </bean>
    
  <bean id="someDao" parent="abstractDao">
    <property name="proxyInterfaces">
      <value>com.dao.SomeDao</value>
    </property>
    <property name="target">
      <bean parent="abstractDaoTarget">
        <constructor-arg>
          <value>com.domain.SomeBean</value>
        </constructor-arg>
      </bean>
    </property>
  </bean>