DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Thomas has posted 33 posts at DZone. View Full User Profile

Make @Service Annotated Spring Bean Method Calls Transactional

  • submit to reddit
  <tx:advice id="txAdvice">
      <tx:method name="*" propagation="SUPPORTS" read-only="true" />
    <!-- the execution of every methods of every @Service annotated Spring bean -->
    <aop:pointcut id="withinServiceAnnotatedClass" expression="@within(org.springframework.stereotype.Service)" />
    <aop:advisor advice-ref="txAdvice" pointcut-ref="withinServiceAnnotatedClass"/>