org.springframework.context.annotation
Class ConfigurationClassEnhancer

java.lang.Object
  extended by org.springframework.context.annotation.ConfigurationClassEnhancer

 class ConfigurationClassEnhancer
extends java.lang.Object

Enhances Configuration classes by generating a CGLIB subclass capable of interacting with the Spring container to respect bean semantics.

Since:
3.0
Author:
Chris Beams, Juergen Hoeller
See Also:
enhance(java.lang.Class), ConfigurationClassPostProcessor

Nested Class Summary
private static class ConfigurationClassEnhancer.BeanMethodInterceptor
          Intercepts the invocation of any Bean-annotated methods in order to ensure proper handling of bean semantics such as scoping and AOP proxying.
private static class ConfigurationClassEnhancer.GetObjectMethodInterceptor
          Intercepts calls to FactoryBean.getObject(), delegating to calling BeanFactory.getBean(String) in order to respect caching / scoping.
 
Field Summary
private  CallbackFilter callbackFilter
           
private  java.util.List<Callback> callbackInstances
           
private  java.util.List<java.lang.Class<? extends Callback>> callbackTypes
           
private static Log logger
           
 
Constructor Summary
ConfigurationClassEnhancer(ConfigurableBeanFactory beanFactory)
          Creates a new ConfigurationClassEnhancer instance.
 
Method Summary
private  java.lang.Class<?> createClass(Enhancer enhancer)
          Uses enhancer to generate a subclass of superclass, ensuring that callbackInstances are registered for the new subclass.
 java.lang.Class<?> enhance(java.lang.Class<?> configClass)
          Loads the specified class and generates a CGLIB subclass of it equipped with container-aware callbacks capable of respecting scoping and other bean semantics.
private  Enhancer newEnhancer(java.lang.Class<?> superclass)
          Creates a new CGLIB Enhancer instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final Log logger

callbackInstances

private final java.util.List<Callback> callbackInstances

callbackTypes

private final java.util.List<java.lang.Class<? extends Callback>> callbackTypes

callbackFilter

private final CallbackFilter callbackFilter
Constructor Detail

ConfigurationClassEnhancer

public ConfigurationClassEnhancer(ConfigurableBeanFactory beanFactory)
Creates a new ConfigurationClassEnhancer instance.

Method Detail

enhance

public java.lang.Class<?> enhance(java.lang.Class<?> configClass)
Loads the specified class and generates a CGLIB subclass of it equipped with container-aware callbacks capable of respecting scoping and other bean semantics.

Returns:
fully-qualified name of the enhanced subclass

newEnhancer

private Enhancer newEnhancer(java.lang.Class<?> superclass)
Creates a new CGLIB Enhancer instance.


createClass

private java.lang.Class<?> createClass(Enhancer enhancer)
Uses enhancer to generate a subclass of superclass, ensuring that callbackInstances are registered for the new subclass.