SSH项目开发中注入的事务管理器

<bean id="sessionFactory"
	class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
	<property name="configLocation"
		value="classpath:hibernate.cfg.xml">
	</property>
</bean>
	
<!-- ======================事务管理器========================= -->
	
<bean name="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
	<property name="sessionFactory" ref="sessionFactory"></property>		
</bean>
		
	
<!-- ==============================事务工厂============================== -->

<bean name="baseTransactionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
		abstract="true">
	<property name="transactionManager" ref="transactionManager"></property>
	<property name="transactionAttributes">
		<props>
			<prop key="insert*">PROPAGATION_REQUIRED</prop>
			<prop key="update*">PROPAGATION_REQUIRED</prop>
			<prop key="*">PROPAGATION_REQUIRED</prop>
		</props>		
	</property>
</bean>	
	

 action中添加spring插件,action引用对象改成代理类

 <action
      attribute="userForm"
      input="/form/user.jsp"
      name="userForm"
      parameter="task"
      path="/user"
      scope="request"
      type="org.springframework.web.struts.DelegatingActionProxy" />

	</action-mappings>

	<message-resources parameter="com.fxzutils.struts.ApplicationResources" />
	<plug-in
		className="org.springframework.web.struts.ContextLoaderPlugIn">
		<set-property property="contextConfigLocation"
			value="/WEB-INF/classes/applicationContext*.xml" />
	</plug-in>

 

你可能感兴趣的:(spring,bean,struts,项目管理,ssh)