As we've previously seen, we have at our disposal two kinds of proxies: the ones provided by JDK, which we can also write as seen in the previous section, and those provided by the CGLIB, which work in a transparent manner.
In everyday use, we don't directly use either of the two implementations. We rather rely on a factory that provides the proxy class ready for use. This allows us to focus our attention and development on crosscutting concerns to apply through the proxy, rather than focus on the proxy.
To make our job easier Spring provides the class org.springframework.aop.config.ProxyFactoryBean
, and we mostly use it in a declarative way by doing the "dirty work" that we have seen. It is necessary to create and use proxies in a programmatic way. ProxyFactoryBean
is a central component in SpringAOP because if proxies act as links among advices, targets, joinpoints, and advisors, the ProxyFactoryBean
performs its tasks in a declarative manner rather than by code in a programmatic...