Aware
marker interface serves as the parent for a large number of interfaces with names ending in *Aware
. Each of these, when implemented, provides the bean with a specific entity unique to it. For example, a component that needs to access the application context should implement ApplicationContextAware
.Technically, the interfaces themselves do nothing. An interface like
FooAware
typically declares a single method, void setFoo(Foo value)
. Through this method, an associated BeanPostProcessor
will pass the required entity to the bean.If a bean implements
ServletContextAware
, then during the bean’s initialization, the ServletContextAwareProcessor
will come along and invoke setServletContext
with the servlet context as a parameter.