xml配置以下:
<!-- 属性文件读入 --> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath*:config/jdbc.properties</value> </list> </property> </bean> <!-- 支撑 @Transactional 标志 --> <tx:annotation-driven/> <!-- 支撑 @AspectJ 标志--> <aop:aspectj-autoproxy/> <!-- 以AspectJ方法 定义 AOP --> <aop:config proxy-target-class="true"> <aop:advisor pointcut="execution(* org.springside.core.dao.*Dao.*(..))" advice-ref="txAdvice"/> </aop:config> <!-- 根本领务定义,应用transactionManager作事务管理,默许get*办法的事务为readonly,其余办法按默许设置. 默许的设置请参考Spring文档事务一章. --> <tx:advice id="txAdvice" > <tx:attributes> <tx:method name="query*" read-only="true" propagation="NOT_SUPPORTED"/> <tx:method name="get*" read-only="true" propagation="NOT_SUPPORTED"/> <tx:method name="save*" read-only="true" propagation="REQUIRED"/> </tx:attributes> </tx:advice><!-- 属性文件读入 --> <bean id="propertyConfi