PDA

View Full Version : AspectJ & spring integration



MmarcoM
Apr 16th, 2005, 10:55 AM
hello all,
can anyone tell me how to integrate aspectj with Spring?
i have found a site where a sample is shown
http://www.aspectprogrammer.org/blogs/adrian/2004/05/what_the_teache.html

however i was not able to find class

org.aspectj.springframework.beans.factory.config.A spectBootstrapBean

And, same issue with Spring reference documentation (Chapter 6).

the method 'factory-method="aspectOf" ' is not shown..
where does it come from?

can anyone help me?

thanx and regards
marco

Rod Johnson
Apr 16th, 2005, 11:16 AM
The example in chapter 6 of the Reference Manual is complete. factory-method is an IoC container feature, telling Spring to call a static method to obtain an instance of the class to apply Setter Injection to.

Adrian's blog was written before we added this feature, specifically to support AspectJ (although it's also useful in some other cases).

Uses factory-method="aspectOf" you cause the IoC container to get the instance of a singleton aspect. It can then apply Dependency Injection to it, configuring how it will subsequently behave.

robh
Apr 17th, 2005, 05:58 AM
Marco,

The aspectOf() method is a method that your singleton AspectJ aspect will expose as part of its API. It allows Spring to access the singleton instance and then configure it.

For non-singleton aspects, check out the work in progress over at www.aspectprogrammer.org.

Rob