Announcement Announcement Module
Collapse
No announcement yet.
can private method be intercepted or advised? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • can private method be intercepted or advised?

    I have tried unsuccessfully to intercept private methods using CGLIB proxies. I didn't expect Dynamic proxy to work because methods were not implemented from interfaces. However, I thought CGLIB would. My public methods get intercepted. I have searched in the forum and found some threads discussing how to intercept a protected method and some one already found
    the solution for it. But there is no any information for my problem. Does anyone knows CGLIB can intercept a private method or not? Thanks!

  • #2
    You cannot intercept private methods with CGLIB proxies. The reason is, that private methods can only be called from other methods of the target object itself. Such self-invocations cannot be intercepted by the proxy (reasons for that are covered in many forum posts and in the reference).

    Regards,
    Andreas

    Comment

    Working...
    X