Top Description Fields Constructors Methods
org.springframework.context.weaving

public Class LoadTimeWeaverAwareProcessor

extends Object
implements BeanPostProcessor, BeanFactoryAware
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.Aware, org.springframework.beans.factory.config.BeanPostProcessor
Imports
org.springframework.beans.BeansException, org.springframework.beans.factory.BeanFactory, .BeanFactoryAware, org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.context.ConfigurableApplicationContext, org.springframework.instrument.classloading.LoadTimeWeaver, org.springframework.lang.Nullable, org.springframework.util.Assert

org.springframework.beans.factory.config.BeanPostProcessor implementation that passes the context's default LoadTimeWeaver to beans that implement the LoadTimeWeaverAware interface.

Application contexts will automatically register this with their underlying bean factory, provided that a default LoadTimeWeaver is actually available.

Applications should not use this class directly.

Author
Juergen Hoeller
Since
2.5
See Also
LoadTimeWeaverAware, org.springframework.context.ConfigurableApplicationContext#LOAD_TIME_WEAVER_BEAN_NAME

Field Summary

Modifier and TypeField and Description
private BeanFactory
private LoadTimeWeaver

Constructor Summary

AccessConstructor and Description
public
LoadTimeWeaverAwareProcessor()

Create a new LoadTimeWeaverAwareProcessor that will auto-retrieve the LoadTimeWeaver from the containing BeanFactory, expecting a bean named "loadTimeWeaver".

public
LoadTimeWeaverAwareProcessor(LoadTimeWeaver
the specific LoadTimeWeaver that is to be used
loadTimeWeaver
)

Create a new LoadTimeWeaverAwareProcessor for the given LoadTimeWeaver.

public
LoadTimeWeaverAwareProcessor(BeanFactory
the BeanFactory to retrieve the LoadTimeWeaver from
beanFactory
)

Create a new LoadTimeWeaverAwareProcessor.

Method Summary

Modifier and TypeMethod and Description
public Object
postProcessAfterInitialization(Object
the new bean instance
bean
,
String
the name of the bean
name
)

Overrides default org.springframework.beans.factory.config.BeanPostProcessor.postProcessAfterInitialization.

Apply this BeanPostProcessor to the given new bean instance after any bean initialization callbacks (like InitializingBean's afterPropertiesSet or a custom init-method).
public Object
postProcessBeforeInitialization(Object
the new bean instance
bean
,
String
the name of the bean
beanName
)

Overrides default org.springframework.beans.factory.config.BeanPostProcessor.postProcessBeforeInitialization.

Apply this BeanPostProcessor to the given new bean instance before any bean initialization callbacks (like InitializingBean's afterPropertiesSet or a custom init-method).
public void
setBeanFactory(BeanFactory
owning BeanFactory (never null). The bean can immediately call methods on the factory.
beanFactory
)

Implements org.springframework.beans.factory.BeanFactoryAware.setBeanFactory.

Callback that supplies the owning factory to a bean instance.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

beanFactoryback to summary
private BeanFactory beanFactory
Annotations
@Nullable
loadTimeWeaverback to summary
private LoadTimeWeaver loadTimeWeaver
Annotations
@Nullable

Constructor Detail

LoadTimeWeaverAwareProcessorback to summary
public LoadTimeWeaverAwareProcessor()

Create a new LoadTimeWeaverAwareProcessor that will auto-retrieve the LoadTimeWeaver from the containing BeanFactory, expecting a bean named "loadTimeWeaver".

LoadTimeWeaverAwareProcessorback to summary
public LoadTimeWeaverAwareProcessor(LoadTimeWeaver loadTimeWeaver)

Create a new LoadTimeWeaverAwareProcessor for the given LoadTimeWeaver.

If the given loadTimeWeaver is null, then a LoadTimeWeaver will be auto-retrieved from the containing BeanFactory, expecting a bean named "loadTimeWeaver".

Parameters
loadTimeWeaver:LoadTimeWeaver

the specific LoadTimeWeaver that is to be used

LoadTimeWeaverAwareProcessorback to summary
public LoadTimeWeaverAwareProcessor(BeanFactory beanFactory)

Create a new LoadTimeWeaverAwareProcessor.

The LoadTimeWeaver will be auto-retrieved from the given BeanFactory, expecting a bean named "loadTimeWeaver".

Parameters
beanFactory:BeanFactory

the BeanFactory to retrieve the LoadTimeWeaver from

Method Detail

postProcessAfterInitializationback to summary
public Object postProcessAfterInitialization(Object bean, String name)

Overrides default org.springframework.beans.factory.config.BeanPostProcessor.postProcessAfterInitialization.

Doc from org.springframework.beans.factory.config.BeanPostProcessor.postProcessAfterInitialization.

Apply this BeanPostProcessor to the given new bean instance after any bean initialization callbacks (like InitializingBean's afterPropertiesSet or a custom init-method). The bean will already be populated with property values. The returned bean instance may be a wrapper around the original.

In case of a FactoryBean, this callback will be invoked for both the FactoryBean instance and the objects created by the FactoryBean (as of Spring 2.0). The post-processor can decide whether to apply to either the FactoryBean or created objects or both through corresponding bean instanceof FactoryBean checks.

This callback will also be invoked after a short-circuiting triggered by a InstantiationAwareBeanPostProcessor#postProcessBeforeInstantiation method, in contrast to all other BeanPostProcessor callbacks.

The default implementation returns the given bean as-is.

Parameters
bean:Object

the new bean instance

name:String

the name of the bean

Returns:Object

the bean instance to use, either the original or a wrapped one; if null, no subsequent BeanPostProcessors will be invoked

Annotations
@Override
postProcessBeforeInitializationback to summary
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException

Overrides default org.springframework.beans.factory.config.BeanPostProcessor.postProcessBeforeInitialization.

Doc from org.springframework.beans.factory.config.BeanPostProcessor.postProcessBeforeInitialization.

Apply this BeanPostProcessor to the given new bean instance before any bean initialization callbacks (like InitializingBean's afterPropertiesSet or a custom init-method). The bean will already be populated with property values. The returned bean instance may be a wrapper around the original.

The default implementation returns the given bean as-is.

Parameters
bean:Object

the new bean instance

beanName:String

the name of the bean

Returns:Object

the bean instance to use, either the original or a wrapped one; if null, no subsequent BeanPostProcessors will be invoked

Annotations
@Override
Exceptions
BeansException:
in case of errors
setBeanFactoryback to summary
public void setBeanFactory(BeanFactory beanFactory)

Implements org.springframework.beans.factory.BeanFactoryAware.setBeanFactory.

Doc from org.springframework.beans.factory.BeanFactoryAware.setBeanFactory.

Callback that supplies the owning factory to a bean instance.

Invoked after the population of normal bean properties but before an initialization callback such as InitializingBean#afterPropertiesSet() or a custom init-method.

Parameters
beanFactory:BeanFactory

owning BeanFactory (never null). The bean can immediately call methods on the factory.

Annotations
@Override