<!-- this is the service object that we want to make transactional -->
<beanid="fooService"class="x.y.service.DefaultFooService"/>
<!-- the transactional advice (what 'happens'; see the <aop:advisor/> bean below) -->
<tx:adviceid="txAdvice"transaction-manager="txManager">
<!-- the transactional semantics... -->
<tx:attributes>
<!-- all methods starting with 'get' are read-only -->
<tx:methodname="get*"read-only="true"/>
<!-- other methods use the default transaction settings (see below) -->
<tx:methodname="*"/>
</tx:attributes>
</tx:advice>
<!-- ensure that the above transactional advice runs for any execution
of an operation defined by the FooService interface -->
<aop:config>
<aop:pointcutid="fooServiceOperation"expression="execution(* x.y.service.FooService.*(..))"/>
<aop:advisoradvice-ref="txAdvice"pointcut-ref="fooServiceOperation"/>
</aop:config>
<!-- don't forget the DataSource -->
<beanid="dataSource"class="org.apache.commons.dbcp.BasicDataSource"destroy-method="close">
<propertyname="driverClassName"value="oracle.jdbc.driver.OracleDriver"/>
<propertyname="url"value="jdbc:oracle:thin:@rj-t42:1521:elvis"/>
<propertyname="username"value="scott"/>
<propertyname="password"value="tiger"/>
</bean>
<!-- similarly, don't forget the PlatformTransactionManager -->
<beanid="txManager"class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<propertyname="dataSource"ref="dataSource"/>
</bean>
execution(public * com.ntadat.spring.ioc.anotation.outowiredquired.dao..*.*(..))这个语法的意思是:切面作用于dao包下面的所有子包下的所有类的所有方法!-- this is the service object that we want to make transactional --> bea