欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

applicationContext.xml 一个代理注入多个?

程序员文章站 2022-06-17 15:47:40
...
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE beans PUBLIC "-//SPRING/DTD BEAN/EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<description>Spring Quick Start</description>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" destroy-method="close">
<property name="driverClassName">
<value>org.postgresql.Driver</value>
</property>
<property name="url">
<value>jdbc:postgresql:datebasename</value>
</property>
<property name="username">
<value>postgres</value>
</property>
<property name="password">
<value>123456</value>
</property>
</bean>

<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource" />
</property>
<property name="mappingResources">
<list>
<value>springWebwork2/Member.hbm.xml</value>
<value>manager/Manager.hbm.xml</value>
<value>showHelper/Block.hbm.xml</value>
<value>showHelper/Edu.hbm.xml</value>
<value>showHelper/Managerkind.hbm.xml</value>
<value>showHelper/Managerrole.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">net.sf.hibernate.dialect.PostgreSQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>

<bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>

<bean id="DAOProxy" abstract="true"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="transactionAttributes">
<props>
<prop key="insert*">PROPAGATION_REQUIRED</prop>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="is*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>

<bean id="MemberProxy" parent="DAOProxy">
<property name="target">
<ref local="MemberLogic"/>
</property>
</bean>

<bean id="MemberLogic" class="springWebwork2.Member_logic">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>

<bean id="ManagerProxy" parent="DAOProxy">
<property name="target">
<ref local="ManagerLogic"/>
</property>
</bean>

<bean id="ManagerLogic" class="manager.Manager_l">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>

<bean id="ShowHelperProxy" parent="DAOProxy">
<property name="target">
<list>
<value>ShowHelperBlock</value>
<value>ShowHelperManagerKind</value>
</list>
</property>
</bean>


<bean id="ShowHelperBlock" class="showHelper.Menu_Block">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>

<bean id="ShowHelperManagerKind" class="showHelper.Menu_ManagerKind">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>

</beans>