public class DeprecatedBeanWarner extends java.lang.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(java.lang.String beanName,
java.lang.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(java.lang.String loggerName)
Set the name of the logger to use.
|
protected void |
writeToLog(java.lang.String message)
Actually write to the underlying log.
|
protected transient Log logger
public void setLoggerName(java.lang.String loggerName)
This can be specified to not log into the category of this warner class but rather into a specific named category.
LogFactory.getLog(String)
,
Logger.getLogger(String)
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(java.lang.String beanName, java.lang.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(java.lang.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.