类 ApplicationContextSupport
- 所有已实现的接口:
Aware,ApplicationContextAware
- 从以下版本开始:
- 2019-12-21 15:45
- 作者:
- TODAY
-
字段概要
字段修饰符和类型字段说明protected ApplicationContextprotected final cn.taketoday.logging.Loggerprotected MessageSourceAccessorMessageSourceAccessor for easy message access. -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明final ApplicationContextReturn the ApplicationContext that this object is associated with.protected final MessageSourceAccessorReturn a MessageSourceAccessor for the application context used by this object, for easy message access.protected voidSubclasses can override this for custom initialization behavior.protected voidinitApplicationContext(ApplicationContext context) Subclasses can override this for custom initialization behavior.protected booleanDetermine whether this application object needs to run in an ApplicationContext.Return the ApplicationContext that this object is associated with.protected Class<?>Determine the context class that any context passed tosetApplicationContextmust be an instance of.final voidsetApplicationContext(ApplicationContext context) Set the ApplicationContext that this object runs in.<T> Tunwrap this ApplicationContext torequiredType<T> TunwrapFactory(Class<T> requiredType) unwrap bean-factory torequiredType
-
字段详细资料
-
log
protected final cn.taketoday.logging.Logger log -
applicationContext
-
messageSourceAccessor
MessageSourceAccessor for easy message access. @since 4.0
-
-
构造器详细资料
-
ApplicationContextSupport
public ApplicationContextSupport()
-
-
方法详细资料
-
setApplicationContext
从接口复制的说明:ApplicationContextAwareSet the ApplicationContext that this object runs in. Normally this call will be used to initialize the object.Invoked after population of normal bean properties but before an init callback such as
InitializingBean.afterPropertiesSet()or a custom init-method. Invoked afterResourceLoaderAware.setResourceLoader(cn.taketoday.core.io.ResourceLoader),ApplicationEventPublisherAware.setApplicationEventPublisher(cn.taketoday.context.ApplicationEventPublisher)andMessageSourceAware, if applicable.- 指定者:
setApplicationContext在接口中ApplicationContextAware- 参数:
context- the ApplicationContext object to be used by this object- 抛出:
ApplicationContextException- in case of context initialization errorsBeansException- if thrown by application context methods- 另请参阅:
-
initApplicationContext
Subclasses can override this for custom initialization behavior. Gets called bysetApplicationContextafter setting the context instance.Note: Does not get called on re-initialization of the context but rather just on first initialization of this object's context reference.
The default implementation calls the overloaded
initApplicationContext()method without ApplicationContext reference.- 参数:
context- the containing ApplicationContext- 抛出:
ApplicationContextException- if thrown by ApplicationContext methods- 另请参阅:
-
initApplicationContext
protected void initApplicationContext()Subclasses can override this for custom initialization behavior.The default implementation is empty. Called by
initApplicationContext(ApplicationContext).- 抛出:
ApplicationContextException- if thrown by ApplicationContext methods- 另请参阅:
-
getApplicationContext
Return the ApplicationContext that this object is associated with.- 抛出:
IllegalStateException- if not running in an ApplicationContext
-
obtainApplicationContext
Return the ApplicationContext that this object is associated with.- 抛出:
IllegalStateException- if not running in an ApplicationContext
-
unwrapFactory
unwrap bean-factory torequiredType- 抛出:
IllegalArgumentException- not a requiredType- 从以下版本开始:
- 4.0
- 另请参阅:
-
unwrap
unwrap this ApplicationContext torequiredType- 抛出:
IllegalArgumentException- not a requiredType- 从以下版本开始:
- 4.0
-
getMessageSourceAccessor
@Nullable protected final MessageSourceAccessor getMessageSourceAccessor() throws IllegalStateExceptionReturn a MessageSourceAccessor for the application context used by this object, for easy message access.- 抛出:
IllegalStateException- if not running in an ApplicationContext- 从以下版本开始:
- 4.0
-
isContextRequired
protected boolean isContextRequired()Determine whether this application object needs to run in an ApplicationContext.Default is "false". Can be overridden to enforce running in a context (i.e. to throw IllegalStateException on accessors if outside a context).
- 从以下版本开始:
- 4.0
- 另请参阅:
-
requiredContextClass
Determine the context class that any context passed tosetApplicationContextmust be an instance of. Can be overridden in subclasses.- 从以下版本开始:
- 4.0
- 另请参阅:
-