Following discussion is based on source code of Spring Framework 6.1.8.
Some commonly used Spring Framework components can be injected into your bean during bean creation.
Commonly used Aware interface
Interface name | Information interested | Injected by |
---|---|---|
org.springframework.context.ApplicationEventPublisherAware | ApplicationEventPublisher | org.springframework.context.support.ApplicationContextAwareProcessor#invokeAwareInterfaces |
org.springframework.context.MessageSourceAware | MessageSource | org.springframework.context.support.ApplicationContextAwareProcessor#invokeAwareInterfaces |
org.springframework.context.EnvironmentAware | Environment | org.springframework.context.support.ApplicationContextAwareProcessor#invokeAwareInterfaces |
org.springframework.beans.factory.BeanNameAware | Bean name | org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory#invokeAwareMethods |
org.springframework.beans.factory.BeanFactoryAware | BeanFactory | org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory#invokeAwareMethods |
org.springframework.context.ApplicationContextAware | ApplicationContext | org.springframework.context.support.ApplicationContextAwareProcessor#invokeAwareInterfaces |