Class DeprecatedBeanWarner
java.lang.Object
org.springframework.beans.factory.config.DeprecatedBeanWarner
- All Implemented Interfaces:
- BeanFactoryPostProcessor
Bean factory post processor that logs a warning for 
@Deprecated beans.- Since:
- 3.0.3
- Author:
- Arjen Poutsma
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected booleanDetermine whether theloggerfield is enabled.protected voidlogDeprecatedBean(String beanName, Class<?> beanType, BeanDefinition beanDefinition) Logs a warning for a bean annotated with@Deprecated.voidpostProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) Modify the application context's internal bean factory after its standard initialization.voidsetLoggerName(String loggerName) Set the name of the logger to use.protected voidwriteToLog(String message) Actually write to the underlying log.
- 
Field Details- 
loggerLogger available to subclasses.
 
- 
- 
Constructor Details- 
DeprecatedBeanWarnerpublic DeprecatedBeanWarner()
 
- 
- 
Method Details- 
setLoggerNameSet the name of the logger to use. The name will be passed to the underlying logger implementation through Commons Logging, getting interpreted as log category according to the logger's configuration.This can be specified to not log into the category of this warner class but rather into a specific named category. 
- 
postProcessBeanFactorypublic void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException Description copied from interface:BeanFactoryPostProcessorModify the application context's internal bean factory after its standard initialization. All bean definitions will have been loaded, but no beans will have been instantiated yet. This allows for overriding or adding properties even to eager-initializing beans.- Specified by:
- postProcessBeanFactoryin interface- BeanFactoryPostProcessor
- Parameters:
- beanFactory- the bean factory used by the application context
- Throws:
- BeansException- in case of errors
 
- 
logDeprecatedBeanLogs a warning for a bean annotated with@Deprecated.- Parameters:
- beanName- the name of the deprecated bean
- beanType- the user-specified type of the deprecated bean
- beanDefinition- the definition of the deprecated bean
 
- 
writeToLogActually write to the underlying log.The default implementations logs the message at "warn" level. - Parameters:
- message- the message to write
 
- 
isLogEnabledprotected boolean isLogEnabled()Determine whether theloggerfield is enabled.Default is truewhen the "warn" level is enabled. Subclasses can override this to change the level under which logging occurs.
 
-