一、Aware
Spring中有一个接口,org.springframework.beans.factory.Aware
aware的意思是意识到,察觉到,be aware of sth.
在Spring中,用这个词来表示Spring往类中设置信息,开发者可以知道被设置的信息。Spring自己定义了很多Aware接口,如:
org.springframework.context.ApplicationContextAware
public interface ApplicationContextAware extends Aware {
/**
* Set the ApplicationContext that this object runs in.
* Normally this call will be used to initialize the object.
* <p>Invoked after population of normal bean properties but before an init callback such
* as {@link org.springframework.beans.factory.InitializingBean#afterPropertiesSet()}
* or a custom init-method. Invoked after {@link ResourceLoaderAware#setResourceLoader},
* {@link ApplicationEventPublisherAware#setApplicationEventPublisher} and
* {@link MessageSourceAware}, if applicable.
* @param applicationContext the ApplicationContext object to