Use of proxies in Spring AOP

前端 未结 4 1736
南旧
南旧 2020-11-29 00:09

I am reading a book, which talks about enabling AspectJ support in Spring AOP.

Given below is a paragraph taken from the book:

To ena

4条回答
  •  青春惊慌失措
    2020-11-29 00:30

    I found a blog here that clearly explains how AOP,Caching & Transaction works using runtime proxy classes.

    When not coding to interface (quoting from the blog's section 'What if the bean class does not implement any interface?'):-

    By default, if your bean does not implement an interface, Spring uses technical inheritance: at startup time, a new class is created. It inherits from your bean class and adds behavior in the child methods. In order to generate such proxies, Spring uses a third party library called cglib.

提交回复
热议问题