What is CGLIB in Spring Framework?

What is CGLIB and how is it related to Spring? Do I need to determine the use of CGLIB explicitly when using the Spring Framework?

+4
source share
1 answer

Ref Spring docs . What is CGLIB and how is it related to Spring?

CGLIB is a code library. Spring uses CGLIB to create a proxy.

Spring AOP by default uses standard dynamic JDK proxies for AOP proxies. This allows you to proxy any interface (or set of interfaces).

Yes, you must tell Spring to explicitly use CGLIB-based credentials.

Via xml:

For property

<aop:aspectj-autoproxy proxy-target-class="true"/> proxy-target-class true, - CGLIB.

:

@Configuration
@EnableAspectJAutoProxy(proxyTargetClass=true)
public class AppConfig {
   // ...
}

CGLIB . Spring 3.2, CGLIB JAR spring -core.

, .

+9

All Articles