This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Rust Web Development and have Bastian Gruber on-line!
See this thread for details.
Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Spring AOP, How does this example do it?

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Finished this tutorial and have a problem grasping how or what advice code is called based on this configuration.
I understand the pointcut and when it will be called based on the pattern. I have done AOP examples before using Annotations and it was easy to see how and what code gets called for the advice. In this case is this some inbuilt Advice that is called or how , if I wanted, Could I reconfigure it to call my own advice method?

http://static.springsource.org/docs/Spring-MVC-step-by-step/part6.html
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

james frain wrote:Finished this tutorial and have a problem grasping how or what advice code is called based on this configuration.
I understand the pointcut and when it will be called based on the pattern. I have done AOP examples before using Annotations and it was easy to see how and what code gets called for the advice. In this case is this some inbuilt Advice that is called or how , if I wanted, Could I reconfigure it to call my own advice method?

http://static.springsource.org/docs/Spring-MVC-step-by-step/part6.html



That is how you configure methods to be Transactional in XML. Versus just putting @Transactional on methods. So the pointcut expression is just there to get a Proxy around any class that matches the advisor pointcut expression. the <tx:advice> part tells which methods in those classes should be transactional and what settings besides the defaults should be set. Read the tx:method part to be like Exception handling, where the first match is used. So in ProductManager all methods are Transactional, but any that start with save have all the defaults, and everything else has all the defaults, but read-only is set to true.

Hope that helps clear things up. It is Transaction configuration all here, not your standard self made AOP here, it is getting Transactions with AOP using two namespaces.

This is a big reason why using Annotations for transactions are so much easier than xml. But some people can't use Annotation so they have to use this approach.

Mark
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic