Initial work to ensure CGLIB classes are not eagerly loaded (CGLIB should only be required if Spring users wish to process @Configuration classes)
This commit is contained in:
parent
93b558b1ce
commit
43b2a40343
|
@ -56,7 +56,7 @@ public @interface FactoryMethod {
|
|||
* Specifies what interceptor should be used when processing this {@link FactoryMethod}.
|
||||
* Defaults to {@link NoOpInterceptor} which does nothing.
|
||||
*/
|
||||
Class<? extends MethodInterceptor> interceptor() default NoOpInterceptor.class;
|
||||
Class<? extends MethodInterceptor> interceptor();
|
||||
|
||||
/**
|
||||
* Optionally specifies any {@link Validator} types capable of validating the syntax of
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.springframework.config.java.support;
|
||||
|
||||
import static org.springframework.util.StringUtils.*;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.config.java.ConfigurationModel;
|
||||
|
@ -7,6 +9,8 @@ import org.springframework.config.java.internal.parsing.ConfigurationParser;
|
|||
|
||||
public abstract class AbstractConfigurationClassProcessor {
|
||||
|
||||
static String CGLIB_PACKAGE = "net.sf.cglib.proxy";
|
||||
|
||||
protected abstract BeanDefinitionRegistry getConfigurationBeanDefinitions(boolean includeAbstractBeanDefs);
|
||||
|
||||
protected abstract ConfigurationParser createConfigurationParser();
|
||||
|
@ -19,6 +23,14 @@ public abstract class AbstractConfigurationClassProcessor {
|
|||
if(configBeanDefs.getBeanDefinitionCount() == 0)
|
||||
return configBeanDefs; // nothing to do - don't waste any more cycles
|
||||
|
||||
// TODO: the location of this cglib check is temporary, pending removal of the
|
||||
// @FactoryMethod meta-annotation indirection
|
||||
if(Package.getPackage(CGLIB_PACKAGE) == null)
|
||||
throw new RuntimeException("CGLIB is required to process @Configuration classes. " +
|
||||
"Either add CGLIB v2.2.3 to the classpath or remove the following " +
|
||||
"@Configuration bean definitions: ["
|
||||
+ arrayToCommaDelimitedString(configBeanDefs.getBeanDefinitionNames()) + "]");
|
||||
|
||||
ConfigurationModel configModel = createConfigurationModelFor(configBeanDefs);
|
||||
|
||||
validateModel(configModel);
|
||||
|
|
Loading…
Reference in New Issue