附上关于这节的spring官方文档:
ApplicationContextAware and BeanNameAware
aware接口在spring中无处不在,它是用来感知spring的ioc container
引用spring官方的一句话:
Spring offers a range of
Aware
callback interfaces that allow beans to indicate to the container that they require a certain infrastructure dependency
这句话真的讲的相当精妙啊!