public class DeprecatedBeanWarner extends Object implements BeanFactoryPostProcessor
@Deprecated
beans.Modifier and Type | Field and Description |
---|---|
protected Log |
logger
Logger available to subclasses.
|
Constructor and Description |
---|
DeprecatedBeanWarner() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
isLogEnabled()
Determine whether the
logger field is enabled. |
protected void |
logDeprecatedBean(String beanName,
Class<?> beanType,
BeanDefinition beanDefinition)
Logs a warning for a bean annotated with
@Deprecated . |
void |
postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
Modify the application context's internal bean factory after its standard
initialization.
|
void |
setLoggerName(String loggerName)
Set the name of the logger to use.
|
protected void |
writeToLog(String message)
Actually write to the underlying log.
|
protected transient Log logger
public void setLoggerName(String loggerName)
This can be specified to not log into the category of this warner class but rather into a specific named category.
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
BeanFactoryPostProcessor
postProcessBeanFactory
in interface BeanFactoryPostProcessor
beanFactory
- the bean factory used by the application contextBeansException
- in case of errorsprotected void logDeprecatedBean(String beanName, Class<?> beanType, BeanDefinition beanDefinition)
@Deprecated
.beanName
- the name of the deprecated beanbeanType
- the user-specified type of the deprecated beanbeanDefinition
- the definition of the deprecated beanprotected void writeToLog(String message)
The default implementations logs the message at "warn" level.
message
- the message to writeprotected boolean isLogEnabled()
logger
field is enabled.
Default is true
when the "warn" level is enabled.
Subclasses can override this to change the level under which logging occurs.