File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -2432,13 +2432,10 @@ so. However, there are some issues to consider:
2432
2432
CGLIB classes are repackaged under org.springframework and included directly in the
2433
2433
spring-core JAR. This means that CGLIB-based proxy support 'just works' in the same
2434
2434
way that JDK dynamic proxies always have.
2435
- * The constructor of your proxied object will be called twice. This is a natural
2436
- consequence of the CGLIB proxy model whereby a subclass is generated for each proxied
2437
- object. For each proxied instance, two objects are created: the actual proxied object
2438
- and an instance of the subclass that implements the advice. This behavior is not
2439
- exhibited when using JDK proxies. Usually, calling the constructor of the proxied type
2440
- twice, is not an issue, as there are usually only assignments taking place and no real
2441
- logic is implemented in the constructor.
2435
+ * As of Spring 4.0, the constructor of your proxied object will NOT be called twice
2436
+ anymore since the CGLIB proxy instance will be created via Objenesis. Only if your
2437
+ JVM does not allow for constructor bypassing, you might see double invocations and
2438
+ corresponding debug log entries from Spring's AOP support.
2442
2439
2443
2440
To force the use of CGLIB proxies set the value of the `proxy-target-class` attribute of
2444
2441
the `<aop:config>` element to true:
You can’t perform that action at this time.
0 commit comments