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

pack-priv Class ApplicationContextAwareProcessor

extends Object
implements BeanPostProcessor
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.config.BeanPostProcessor
Imports
org.springframework.beans.BeansException, org.springframework.beans.factory.Aware, org.springframework.beans.factory.config.BeanPostProcessor, .EmbeddedValueResolver, org.springframework.context.ApplicationContextAware, .ApplicationEventPublisherAware, .ApplicationStartupAware, .ConfigurableApplicationContext, .EmbeddedValueResolverAware, .EnvironmentAware, .MessageSourceAware, .ResourceLoaderAware, org.springframework.lang.Nullable, org.springframework.util.StringValueResolver

BeanPostProcessor implementation that supplies the ApplicationContext, Environment, StringValueResolver, or ApplicationStartup for the ApplicationContext to beans that implement the EnvironmentAware, EmbeddedValueResolverAware, ResourceLoaderAware, ApplicationEventPublisherAware, MessageSourceAware, ApplicationStartupAware, and/or ApplicationContextAware interfaces.

Implemented interfaces are satisfied in the order in which they are mentioned above.

Application contexts will automatically register this with their underlying bean factory. Applications do not use this directly.

Authors
Juergen Hoeller, Costin Leau, Chris Beams, Sam Brannen
Since
10.10.2003
See Also
org.springframework.context.EnvironmentAware, org.springframework.context.EmbeddedValueResolverAware, org.springframework.context.ResourceLoaderAware, org.springframework.context.ApplicationEventPublisherAware, org.springframework.context.MessageSourceAware, org.springframework.context.ApplicationStartupAware, org.springframework.context.ApplicationContextAware, org.springframework.context.support.AbstractApplicationContext#refresh()

Field Summary

Modifier and TypeField and Description
private final ConfigurableApplicationContext
private final StringValueResolver

Constructor Summary

AccessConstructor and Description
public
ApplicationContextAwareProcessor(ConfigurableApplicationContext applicationContext)

Create a new ApplicationContextAwareProcessor for the given context.

Method Summary

Modifier and TypeMethod and Description
private void
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).
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

applicationContextback to summary
private final ConfigurableApplicationContext applicationContext
embeddedValueResolverback to summary
private final StringValueResolver embeddedValueResolver

Constructor Detail

ApplicationContextAwareProcessorback to summary
public ApplicationContextAwareProcessor(ConfigurableApplicationContext applicationContext)

Create a new ApplicationContextAwareProcessor for the given context.

Method Detail

invokeAwareInterfacesback to summary
private void invokeAwareInterfaces(Object bean)
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
@Nullable
Exceptions
BeansException:
in case of errors