From 71d7b22d5e3b7379be61f28b251c60200512f121 Mon Sep 17 00:00:00 2001 From: Costin Leau Date: Tue, 26 Jan 2010 17:02:21 +0000 Subject: [PATCH] SPR-3771 + added table summarizing the Aware interfaces in Spring 3 --- spring-framework-reference/src/beans.xml | 109 +++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/spring-framework-reference/src/beans.xml b/spring-framework-reference/src/beans.xml index 03947fc81a..f6a11e82d7 100644 --- a/spring-framework-reference/src/beans.xml +++ b/spring-framework-reference/src/beans.xml @@ -3667,6 +3667,115 @@ public final class Boot { InitializingBeans afterPropertiesSet or a custom init-method. + +
+ Other <interfacename>Aware</interfacename> interfaces + + Besides ApplicationContextAware and + BeanNameAware discussed above, Spring offers a range + of Aware interfaces that allow beans + to indicate to the container that they require a certain infrastructure dependency. + The most important Aware interfaces are summarized below - as a general rule, + the name is a good indication of the dependency type: + + + <interfacename>Aware</interfacename> interfaces + + + + + + + Name + Injected Dependency + Explained in... + + + + + + ApplicationContextAware + Declaring ApplicationContext + + + + ApplicationEventPublisherAware + Event publisher of the enclosing ApplicationContext + + + + BeanClassLoaderAware + Class loader used to load the bean classes. + + + + BeanFactoryAware + Declaring BeanFactory + + + + BeanNameAware + Name of the declaring bean + + + + BootstrapContextAware + Resource adapter BootstrapContext the container runs in. Typically available only + in JCA aware ApplicationContexts + + + + LoadTimeWeaverAware + Defined weaver for processing class definition at load time + + + + MessageSourceAware + Configured strategy for resolving messages (with support for parametrization and internationalization) + + + + NotificationPublisherAware + Spring JMX notification publisher + + + + PortletConfigAware + Current PortletConfig the container runs in. Valid only in a web-aware Spring + ApplicationContext + + + + PortletContextAware + Current PortletContext the container runs in. Valid only in a web-aware Spring + ApplicationContext + + + + ResourceLoaderAware + Configured loader for low-level access to resources + + + + ServletConfigAware + Current ServletConfig the container runs in. Valid only in a web-aware Spring + ApplicationContext + + + + ServletContextAware + Current ServletContext the container runs in. Valid only in a web-aware Spring + ApplicationContext + + + + +
+ + Note again that usage of these interfaces ties your code to the Spring API and does not follow the Inversion of Control + style. As such, they are recommended for infrastructure beans that require programmatic access to the container. + +
-- GitLab