Vish
Vish

Reputation: 879

Spring Source Tool Help Needed

i am applying AspectJ in spring source tool

do i need to configure load time or compile weaving in spring source tool

i will be very happy if any provide details of using AspectJ for applying Aspect on Spring Source Tool

Upvotes: 0

Views: 157

Answers (1)

Sean Patrick Floyd
Sean Patrick Floyd

Reputation: 298818

This is a very advanced topic, way beyond the scope of a single StackOverflow question.

Basically:

  • The simplest case is Spring AOP, where you don't use AspectJ at all, but create Java proxies from AspectJ annotations. This is also the least powerful option. Only a few pointcuts are supported, and the targets must be Spring Beans.
  • The most powerful option is static AspectJ compilation, which you usually integrate in your build system (works fine with ant or maven). Your class files are actually changed to include the aspects. This is called compile-time weaving.
  • Load-time weaving is somewhere inbetween. You want to advise code, but you don't want to change the class files, so you "advise the classloader" (this is not an adequate definition, but it gives you an idea). Loadtime-weaving is also usually your only choice if you want to add aspects to 3rd party library code.

You should read AspectJ in Action by Ramnivas Laddad to understand all the subtle differences.

Either way, the settings you use in STS should reflect the settings you have in your build system. The section 7. Aspect Oriented Programming with Spring from the Spring Reference is also very helpful.

Upvotes: 2

Related Questions