请问下大家,一个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) -->里面也配一个,不然就报错,这是为什么呢?
解决方案 »
- Map
- 学习SSH架构,看到一段代码,不知道什么意思,请教
- 如何在myeclipse中配置struts和hibernate以及spring?
- 关于一个sqlserver数据库sql语句的写法,多多指点
- Hibernate一次删除多个对象怎么实现?
- 请大家看一下为什么这段代码会出错,我已经启动了weblogic服务器呀 菜鸟问题
- 一个分布式的命令执行系统,大家来提提建议
- java rmi的入门问题
- 一个有关 Struts 的综合的例子...大家进来给出出注意...
- 每次重启服务器都能登录应用,但是隔断时间数据库就连接超时,用的DBCP连接池,各位大哥有没有遇到过啊
- 关于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之前