Skip CGLIB class validation in case of optimize flag
Closes gh-27439
This commit is contained in:
parent
eabe946a53
commit
49d003857d
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2020 the original author or authors.
|
* Copyright 2002-2021 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -237,7 +237,7 @@ class CglibAopProxy implements AopProxy, Serializable {
|
||||||
* validates it if not.
|
* validates it if not.
|
||||||
*/
|
*/
|
||||||
private void validateClassIfNecessary(Class<?> proxySuperClass, @Nullable ClassLoader proxyClassLoader) {
|
private void validateClassIfNecessary(Class<?> proxySuperClass, @Nullable ClassLoader proxyClassLoader) {
|
||||||
if (logger.isWarnEnabled()) {
|
if (!this.advised.isOptimize() && logger.isInfoEnabled()) {
|
||||||
synchronized (validatedClasses) {
|
synchronized (validatedClasses) {
|
||||||
if (!validatedClasses.containsKey(proxySuperClass)) {
|
if (!validatedClasses.containsKey(proxySuperClass)) {
|
||||||
doValidateClass(proxySuperClass, proxyClassLoader,
|
doValidateClass(proxySuperClass, proxyClassLoader,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2021 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -73,11 +73,9 @@ public class ProxyConfig implements Serializable {
|
||||||
* The exact meaning of "aggressive optimizations" will differ
|
* The exact meaning of "aggressive optimizations" will differ
|
||||||
* between proxies, but there is usually some tradeoff.
|
* between proxies, but there is usually some tradeoff.
|
||||||
* Default is "false".
|
* Default is "false".
|
||||||
* <p>For example, optimization will usually mean that advice changes won't
|
* <p>With Spring's current proxy options, this flag effectively
|
||||||
* take effect after a proxy has been created. For this reason, optimization
|
* enforces CGLIB proxies (similar to {@link #setProxyTargetClass})
|
||||||
* is disabled by default. An optimize value of "true" may be ignored
|
* but without any class validation checks (for final methods etc).
|
||||||
* if other settings preclude optimization: for example, if "exposeProxy"
|
|
||||||
* is set to "true" and that's not compatible with the optimization.
|
|
||||||
*/
|
*/
|
||||||
public void setOptimize(boolean optimize) {
|
public void setOptimize(boolean optimize) {
|
||||||
this.optimize = optimize;
|
this.optimize = optimize;
|
||||||
|
|
Loading…
Reference in New Issue