user2993661
user2993661

Reputation: 1

java AOP spring framework

Is it possible to using Spring AOP advisor on a class that is not defined as a bean?

I would like to use a before- and after-advice on a class that is not defined as a bean in spring.xml file.

Thanks in advance!

Upvotes: 0

Views: 85

Answers (1)

kriegaex
kriegaex

Reputation: 67487

As Rohit Jain already stated correctly, objects advised by Spring AOP aspects need to be Spring components. But Spring also nicely plays with native AspectJ, as is described under Using AspectJ with Spring applications. With AspectJ you do not have any such limitations and can easily advise simple POJOs.

Upvotes: 2

Related Questions