请问下大家,一个AOP中应该是可以配置多个业务层的,但是我的配置文件不知道哪出了问题,在一个AOP中配置了多个业务层就会报错,我查了资料好像是要建个opensessionfilter
现在请教一下各位大侠要如何配置opensessionfilter,为什么需要配置这个?
希望大家尽量详细一点,谢谢!以下是我的配置文件:
<!-- 声明式事务切面(AOP) -->
<bean id="txProxyTemplate"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="myTransactionManager" />
</property>
<property name="target">
<ref local="userManageService"/>
</property>
<property name="target">
<ref local="releaseManageService"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="save*">PROPAGATION_REQUIRED </prop>
<prop key="delete*">PROPAGATION_REQUIRED </prop>
<prop key="update*">PROPAGATION_REQUIRED </prop>
<prop key="do*">PROPAGATION_REQUIRED </prop>
<prop key="reg*">PROPAGATION_REQUIRED </prop>
<prop key="login*">PROPAGATION_REQUIRED </prop>
<prop key="*">PROPAGATION_REQUIRED,readOnly </prop>
</props>
</property>
</bean>
<!-- 生成的动态代理类 -->
<bean id="custProxy" parent="txProxyTemplate">
<property name="target">
<ref local="userManageService"/>
</property>
<property name="target">
<ref local="releaseManageService"/>
</property>
<property name="proxyTargetClass">
<value>true < alue>
</property>
</bean>
还有个问题: <property name="target">
<ref local="userManageService"/>
</property>这个属性应该只要在 <!-- 动态代理类 -->里面配就可以了把?
我的不知道为什么一定也要在 <!-- 声明式事务切面(AOP) -->里面也配一个,不然就报错,这是为什么呢?
现在请教一下各位大侠要如何配置opensessionfilter,为什么需要配置这个?
希望大家尽量详细一点,谢谢!以下是我的配置文件:
<!-- 声明式事务切面(AOP) -->
<bean id="txProxyTemplate"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="myTransactionManager" />
</property>
<property name="target">
<ref local="userManageService"/>
</property>
<property name="target">
<ref local="releaseManageService"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="save*">PROPAGATION_REQUIRED </prop>
<prop key="delete*">PROPAGATION_REQUIRED </prop>
<prop key="update*">PROPAGATION_REQUIRED </prop>
<prop key="do*">PROPAGATION_REQUIRED </prop>
<prop key="reg*">PROPAGATION_REQUIRED </prop>
<prop key="login*">PROPAGATION_REQUIRED </prop>
<prop key="*">PROPAGATION_REQUIRED,readOnly </prop>
</props>
</property>
</bean>
<!-- 生成的动态代理类 -->
<bean id="custProxy" parent="txProxyTemplate">
<property name="target">
<ref local="userManageService"/>
</property>
<property name="target">
<ref local="releaseManageService"/>
</property>
<property name="proxyTargetClass">
<value>true < alue>
</property>
</bean>
还有个问题: <property name="target">
<ref local="userManageService"/>
</property>这个属性应该只要在 <!-- 动态代理类 -->里面配就可以了把?
我的不知道为什么一定也要在 <!-- 声明式事务切面(AOP) -->里面也配一个,不然就报错,这是为什么呢?
解决方案 »
- 请教为何调用webservice后session过期?
- 静态属性支持多线程同时访问吗?
- Java Web 程序员工作内容和工作流程以及薪金待遇
- struts+ibatis+spring -------------------------->如何在一个表单插入两张表格.
- 紧急求助:我的BMT stateless session bean,bean class里面的方法调用存储过程,可是为什么总是提示找不到datasource
- Agile和Extreme Programming中要求全部做单元测试,这是怎么做到的?
- 为什么我的tomcat会自动启动?
- 有关Tomcat奇怪的配置问题。网上没有搜到类似问题!!
- 望高人推荐纯java的工作流系统,高分回报!
- tomcat报错看不懂求指教
- 关于Hibernate综合查询解决方案
- 一道重复正则表达式问题
<filter-name>lazyLoadingFilter</filter-name>
<filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
</filter-class>
</filter> <filter-mapping>
<filter-name>lazyLoadingFilter</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>这个是web.xml的配置,并且一定要放在struts2的filter之前