类 DeprecatedBeanWarner
- java.lang.Object
- org.springframework.beans.factory.config.DeprecatedBeanWarner
- 所有已实现的接口:
BeanFactoryPostProcessor
public class DeprecatedBeanWarner extends Object implements BeanFactoryPostProcessor
Bean factory post processor that logs a warning for@Deprecated
beans.- 从以下版本开始:
- 3.0.3
- 作者:
- Arjen Poutsma
构造器概要
构造器 构造器 说明 DeprecatedBeanWarner()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected boolean
isLogEnabled()
Determine whether thelogger
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.
构造器详细资料
DeprecatedBeanWarner
public DeprecatedBeanWarner()
方法详细资料
setLoggerName
public void setLoggerName(String loggerName)
Set 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.
postProcessBeanFactory
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
从接口复制的说明:BeanFactoryPostProcessor
Modify 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.- 指定者:
postProcessBeanFactory
在接口中BeanFactoryPostProcessor
- 参数:
beanFactory
- the bean factory used by the application context- 抛出:
BeansException
- in case of errors
logDeprecatedBean
protected void logDeprecatedBean(String beanName, Class<?> beanType, BeanDefinition beanDefinition)
Logs a warning for a bean annotated with@Deprecated
.- 参数:
beanName
- the name of the deprecated beanbeanType
- the user-specified type of the deprecated beanbeanDefinition
- the definition of the deprecated bean
writeToLog
protected void writeToLog(String message)
Actually write to the underlying log.The default implementations logs the message at "warn" level.
- 参数:
message
- the message to write
isLogEnabled
protected boolean isLogEnabled()
Determine whether thelogger
field is enabled.Default is
true
when the "warn" level is enabled. Subclasses can override this to change the level under which logging occurs.