I have "inherited" an old legacy Spring application. Currently it is using Spring 2.5 (just upgraded it once), and am looking to further upgrade it to Spring 3.
I understand most of the application configuration. There is just one part that I am "not 100%" about. I can guess roughly what it might mean but I need to be absolutely sure hence posting this question:
Here is the configuration snippet (depends on an annotation driven transaction manager not shown here):
<aop:config>
<aop:advisor pointcut="execution(* *..ProductManager.*(..))"
advice-ref="txAdvice" />
</aop:config>
<tx:advice id="txAdvice">
<tx:attributes>
<tx:method name="save*" />
<tx:method name="*" read-only="false" />
</tx:attributes>
</tx:advice>
My specific two questions are:
Thanks for any clarifications. Please, no general answers - I need a concrete explanation for this.
As tx:method
has attribute read-only
with default value as false, means transaction is read/write.
So in my opinion,
<tx:method name="save*" read-only="false" /> <tx:method name="*" />
is equivalent to
<tx:method name="*" />
execution(* *..ProductManager.*(..))
means that, "for all the methods in the ProductManager class"
tx:advice settings are not additive. It says that for all methods beginning with save use the default transaction settings. For the others, this setting means they are NOT read-only transactions.
For the common sense, one would expect
<tx:method name="save*" read-only="false" />
<tx:method name="*" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.