Announcement Announcement Module
Collapse
No announcement yet.
AOP doesn't work for, trying to interfere with the bean lifecycle Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • AOP doesn't work for, trying to interfere with the bean lifecycle

    I have tried to use Spring AOP in order to add some monitoring to my classes.
    The idea was to use a custom annotation to mark the relevant method I want to have monitor on.

    With AOP it can be done by something like:
    @Around(value = "@annotation(benchmark)")

    The thing is I have some restrictions:
    1. I have final properties in my classes with a corresponding constructor (no default constructor)
    2. I doesn't necessarily have interface to each one of my classes.

    AOP doesn't go well with those restrictions(Unless I am missing anything..), so I need to find a different solution.

    I thought maybe to use the lifecycle process of the spring beans.
    While the application context is starting, I need some how to take out the beans which have certain annotation above at least one of their methods, and create a proxy that warps the method with a timer or a counter.

    Maybe someone can direct me to the right path..
    Thanks!
Working...
X