[code="java"]
PROPAGATION_REQUIRED,readOnly
PROPAGATION_REQUIRED,readOnly
PROPAGATION_REQUIRED,readOnly
PROPAGATION_REQUIRED,readOnly
PROPAGATION_REQUIRED,readOnly
<prop key="add*">PROPAGATION_NESTED</prop>
<prop key="insert*">PROPAGATION_NESTED</prop>
<prop key="save*">PROPAGATION_NESTED</prop>
<prop key="doVerify*">PROPAGATION_NESTED</prop>
<prop key="update*">PROPAGATION_NESTED</prop>
<prop key="delete*">PROPAGATION_NESTED</prop>
<prop key="remove*">PROPAGATION_NESTED</prop>
<prop key="findSession">PROPAGATION_NESTED</prop>
</props>
</property>
</bean>
<!-- 资源文件绑定器 -->
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="message-info"/>
<property name="useCodeAsDefaultMessage" value="true"/>
</bean>
<bean id="BeanNameAutoProxyCreator"
class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="beanNames">
<value>*Service</value>
</property>
<property name="interceptorNames">
<list>
<value>transInterceptor</value>
</list>
</property>
<property name="proxyTargetClass" >
<value>true</value>
</property>
</bean>[/code]
[quote]
我所有程序都做好了 换了jar包 程序不得重新写了吗?
[/quote]
不是让你换包,因为你不是有了spring2.5么,应该就直接像我那样配置了。
propagation="REQUIRED" 就够了。
PROPAGATION_REQUIRED 应该可以。
还有 你是报错 还是没起作用?
我的配置是:
[code="xml"]
<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans D:\workspace\Baibuting\resource\spring-beans-2.5.xsd
http://www.springframework.org/schema/tx D:\workspace\Baibuting\resource\spring-tx-2.5.xsd
http://www.springframework.org/schema/aop D:\workspace\Baibuting\resource\spring-aop-2.5.xsd "
default-autowire="byType">
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>
<!-- 配置事务管理器 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<!-- 配置事务的传播特性 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="save*" propagation="REQUIRED" />
<tx:method name="delete*" propagation="REQUIRED" />
<tx:method name="remove*" propagation="REQUIRED" />
<tx:method name="modify*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="*" read-only="true" />
</tx:attributes>
</tx:advice>
<!-- -->
aop:config
advice-ref="txAdvice" />
/aop:config
[/code]
[quote]哦 我感觉不是这个配置的问题吧? [/quote]你使用spring其他功能是好的么?
还有,你貌似对哪个文件夹下的路径没有拦截啊,就比如我的是
pointcut="execution(* org.afei.*.service.*.*(..))"
这个文件夹下面的。
你spring版本多少。
[quote]这个我还真不知道我是把两个版本合起来的 [/quote]
够牛逼 哈哈,你可以看一下你的jar包 和你的xsd文件。
[quote]2.0和2.5合并起来的吧 和这个有关系吗[/quote]这玩意真说不定,你改成2.5好啦,就直接可以用我的呢,配置超级简单。不懂的还可以问我。