Java Reference
In-Depth Information
<aop:config>
<aop:pointcut id="uwrServiceMethods" expression="execution
å
(* com.apress.einsure.business.*.Underwriting*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="uwrServiceMethods"/>
</aop:config>
<!-- other beans -->
</beans>
Finally, I will set up the transaction attributes applicable to the methods of the appli-
cation service, as shown in Listing 6-32.
Listing 6-32.
transaction-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="
http://www.springframework.org/schema/beans"
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="
<!-- this is the service object on which the transaction has to be applied -->
<bean name="uwrAppService"
class="com.apress.einsure.business.impl.
å
UnderwritingApplicationServiceImpl">
</bean>
<!-- the transactional advice decides what needs to be done -->
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<!-- all methods starting with 'list' fetch data from db, hence read-only -->
<tx:method name="list*" read-only="true"/>
