From 5e6912302af99d78d05aff7080ed9b8bb33df913 Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Mon, 3 Jan 2011 10:13:57 +0000 Subject: [PATCH] Introduce "Aware" superinterface All existing *Aware interfaces have been refactored to extend this new marker interface, serving two purposes: * Easy access to a type hierarchy that can answer the question "What *Aware interfaces are available?", without requiring text-based searches. Also clearly excludes false positives like TargetClassAware and ParamAware, which while similarly named, are not semantically similar to traditional *Aware interfaces in Spring. * Minor potential performance improvements in AbstractAutowireCapableBeanFactory and ApplicationContextAwareProcessor. Both have blocks of sequential instanceof checks in order to invoke any *Aware interface callback methods. For a bean that implements none of these interfaces, the whole sequence can be avoided by guarding first with if (bean instanceof Aware) { ... } Implementors of custom *Aware-style interfaces (and presumably the BeanPostProcessors that handle them), are encouraged to refactor to extending this interface for consistency with the framework as well as the points above. --- .../springframework/beans/factory/Aware.java | 39 +++++++++++++++++++ .../beans/factory/BeanClassLoaderAware.java | 5 ++- .../beans/factory/BeanFactoryAware.java | 5 ++- .../beans/factory/BeanNameAware.java | 5 ++- .../AbstractAutowireCapableBeanFactory.java | 21 +++++----- .../support/DefaultListableBeanFactory.java | 1 - .../quartz/SchedulerContextAware.java | 6 ++- .../context/ApplicationContextAware.java | 6 ++- .../ApplicationEventPublisherAware.java | 7 +++- .../context/EmbeddedValueResolverAware.java | 6 ++- .../context/EnvironmentAware.java | 5 ++- .../context/MessageSourceAware.java | 7 +++- .../context/ResourceLoaderAware.java | 6 ++- .../ApplicationContextAwareProcessor.java | 39 ++++++++++--------- .../context/weaving/LoadTimeWeaverAware.java | 6 ++- .../NotificationPublisherAware.java | 7 +++- .../jca/context/BootstrapContextAware.java | 7 +++- .../portlet/context/PortletConfigAware.java | 7 +++- .../portlet/context/PortletContextAware.java | 7 +++- .../web/context/ServletConfigAware.java | 7 +++- .../web/context/ServletContextAware.java | 7 +++- 21 files changed, 144 insertions(+), 62 deletions(-) create mode 100644 org.springframework.beans/src/main/java/org/springframework/beans/factory/Aware.java diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/Aware.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/Aware.java new file mode 100644 index 00000000000..fb107425c36 --- /dev/null +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/Aware.java @@ -0,0 +1,39 @@ +/* + * Copyright 2002-2011 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.beans.factory; + +/** + * Marker superinterface indicating that a bean is eligible to be + * notified by the Spring container of a particular framework object + * through a callback-style method. Actual method signature is + * determined by individual subinterfaces, but should typically + * consist of just one void-returning method that accepts a single + * argument. + * + *

Note that merely implementing {@link Aware} provides no default + * functionality. Rather, processing must be done explicitly, for example + * in a {@link org.springframework.beans.factory.config.BeanPostProcessor BeanPostProcessor}. + * Refer to {@link org.springframework.context.support.ApplicationContextAwareProcessor} + * and {@link org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory} + * for examples of processing {@code *Aware} interface callbacks. + * + * @author Chris Beams + * @since 3.1 + */ +public interface Aware { + +} diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/BeanClassLoaderAware.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/BeanClassLoaderAware.java index efa7d9e4305..5ec48321637 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/BeanClassLoaderAware.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/BeanClassLoaderAware.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,12 +29,13 @@ package org.springframework.beans.factory; * {@link BeanFactory BeanFactory javadocs}. * * @author Juergen Hoeller + * @author Chris Beams * @since 2.0 * @see BeanNameAware * @see BeanFactoryAware * @see InitializingBean */ -public interface BeanClassLoaderAware { +public interface BeanClassLoaderAware extends Aware { /** * Callback that supplies the bean {@link ClassLoader class loader} to diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/BeanFactoryAware.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/BeanFactoryAware.java index b8a224262cb..f9ea34c86bb 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/BeanFactoryAware.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/BeanFactoryAware.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2010 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,13 +31,14 @@ import org.springframework.beans.BeansException; * {@link BeanFactory BeanFactory javadocs}. * * @author Rod Johnson + * @author Chris Beams * @since 11.03.2003 * @see BeanNameAware * @see BeanClassLoaderAware * @see InitializingBean * @see org.springframework.context.ApplicationContextAware */ -public interface BeanFactoryAware { +public interface BeanFactoryAware extends Aware { /** * Callback that supplies the owning factory to a bean instance. diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/BeanNameAware.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/BeanNameAware.java index 580850d3a40..2f41696c690 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/BeanNameAware.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/BeanNameAware.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,12 +27,13 @@ package org.springframework.beans.factory; * {@link BeanFactory BeanFactory javadocs}. * * @author Juergen Hoeller + * @author Chris Beams * @since 01.11.2003 * @see BeanClassLoaderAware * @see BeanFactoryAware * @see InitializingBean */ -public interface BeanNameAware { +public interface BeanNameAware extends Aware { /** * Set the name of the bean in the bean factory that created this bean. diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java index b2b1741f931..75bdd689d59 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java @@ -48,6 +48,7 @@ import org.springframework.beans.PropertyAccessorUtils; import org.springframework.beans.PropertyValue; import org.springframework.beans.PropertyValues; import org.springframework.beans.TypeConverter; +import org.springframework.beans.factory.Aware; import org.springframework.beans.factory.BeanClassLoaderAware; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.BeanCurrentlyInCreationException; @@ -1426,16 +1427,18 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac } return wrappedBean; } - + private void invokeAwareMethods(final String beanName, final Object bean) { - if (bean instanceof BeanNameAware) { - ((BeanNameAware) bean).setBeanName(beanName); - } - if (bean instanceof BeanClassLoaderAware) { - ((BeanClassLoaderAware) bean).setBeanClassLoader(getBeanClassLoader()); - } - if (bean instanceof BeanFactoryAware) { - ((BeanFactoryAware) bean).setBeanFactory(AbstractAutowireCapableBeanFactory.this); + if (bean instanceof Aware) { + if (bean instanceof BeanNameAware) { + ((BeanNameAware) bean).setBeanName(beanName); + } + if (bean instanceof BeanClassLoaderAware) { + ((BeanClassLoaderAware) bean).setBeanClassLoader(getBeanClassLoader()); + } + if (bean instanceof BeanFactoryAware) { + ((BeanFactoryAware) bean).setBeanFactory(AbstractAutowireCapableBeanFactory.this); + } } } diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java index 2a5c55ec45f..705722871db 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java @@ -203,7 +203,6 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto */ public void setAutowireCandidateResolver(final AutowireCandidateResolver autowireCandidateResolver) { Assert.notNull(autowireCandidateResolver, "AutowireCandidateResolver must not be null"); - // TODO SPR-7515: should also do EnvironmentAware injection here? if (autowireCandidateResolver instanceof BeanFactoryAware) { if (System.getSecurityManager() != null) { final BeanFactory target = this; diff --git a/org.springframework.context.support/src/main/java/org/springframework/scheduling/quartz/SchedulerContextAware.java b/org.springframework.context.support/src/main/java/org/springframework/scheduling/quartz/SchedulerContextAware.java index 72f71f6501e..9f2c48a23de 100644 --- a/org.springframework.context.support/src/main/java/org/springframework/scheduling/quartz/SchedulerContextAware.java +++ b/org.springframework.context.support/src/main/java/org/springframework/scheduling/quartz/SchedulerContextAware.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package org.springframework.scheduling.quartz; import org.quartz.SchedulerContext; +import org.springframework.beans.factory.Aware; /** * Callback interface to be implemented by Spring-managed @@ -27,11 +28,12 @@ import org.quartz.SchedulerContext; * that are passed in via Spring's SchedulerFactoryBean. * * @author Juergen Hoeller + * @author Chris Beams * @since 2.0 * @see org.quartz.spi.JobFactory * @see SchedulerFactoryBean#setJobFactory */ -public interface SchedulerContextAware { +public interface SchedulerContextAware extends Aware { /** * Set the SchedulerContext of the current Quartz Scheduler. diff --git a/org.springframework.context/src/main/java/org/springframework/context/ApplicationContextAware.java b/org.springframework.context/src/main/java/org/springframework/context/ApplicationContextAware.java index f26919e81a9..07a7f7f3ec8 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/ApplicationContextAware.java +++ b/org.springframework.context/src/main/java/org/springframework/context/ApplicationContextAware.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package org.springframework.context; import org.springframework.beans.BeansException; +import org.springframework.beans.factory.Aware; /** * Interface to be implemented by any object that wishes to be notified @@ -48,13 +49,14 @@ import org.springframework.beans.BeansException; * * @author Rod Johnson * @author Juergen Hoeller + * @author Chris Beams * @see ResourceLoaderAware * @see ApplicationEventPublisherAware * @see MessageSourceAware * @see org.springframework.context.support.ApplicationObjectSupport * @see org.springframework.beans.factory.BeanFactoryAware */ -public interface ApplicationContextAware { +public interface ApplicationContextAware extends Aware { /** * Set the ApplicationContext that this object runs in. diff --git a/org.springframework.context/src/main/java/org/springframework/context/ApplicationEventPublisherAware.java b/org.springframework.context/src/main/java/org/springframework/context/ApplicationEventPublisherAware.java index e0a0c5a4e8e..ef8ea5407d8 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/ApplicationEventPublisherAware.java +++ b/org.springframework.context/src/main/java/org/springframework/context/ApplicationEventPublisherAware.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,16 +16,19 @@ package org.springframework.context; +import org.springframework.beans.factory.Aware; + /** * Interface to be implemented by any object that wishes to be notified * of the ApplicationEventPublisher (typically the ApplicationContext) * that it runs in. * * @author Juergen Hoeller + * @author Chris Beams * @since 1.1.1 * @see ApplicationContextAware */ -public interface ApplicationEventPublisherAware { +public interface ApplicationEventPublisherAware extends Aware { /** * Set the ApplicationEventPublisher that this object runs in. diff --git a/org.springframework.context/src/main/java/org/springframework/context/EmbeddedValueResolverAware.java b/org.springframework.context/src/main/java/org/springframework/context/EmbeddedValueResolverAware.java index 7749230f676..a3f3a0ce2f9 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/EmbeddedValueResolverAware.java +++ b/org.springframework.context/src/main/java/org/springframework/context/EmbeddedValueResolverAware.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ package org.springframework.context; +import org.springframework.beans.factory.Aware; import org.springframework.util.StringValueResolver; /** @@ -26,10 +27,11 @@ import org.springframework.util.StringValueResolver; * ApplicationContextAware/BeanFactoryAware interfaces. * * @author Juergen Hoeller + * @author Chris Beams * @since 3.0.3 * @see org.springframework.beans.factory.config.ConfigurableBeanFactory#resolveEmbeddedValue */ -public interface EmbeddedValueResolverAware { +public interface EmbeddedValueResolverAware extends Aware { /** * Set the StringValueResolver to use for resolving embedded definition values. diff --git a/org.springframework.context/src/main/java/org/springframework/context/EnvironmentAware.java b/org.springframework.context/src/main/java/org/springframework/context/EnvironmentAware.java index d71b5ee3043..0d94342992d 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/EnvironmentAware.java +++ b/org.springframework.context/src/main/java/org/springframework/context/EnvironmentAware.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ package org.springframework.context; +import org.springframework.beans.factory.Aware; import org.springframework.core.env.Environment; /** @@ -25,7 +26,7 @@ import org.springframework.core.env.Environment; * @author Chris Beams * @since 3.1 */ -public interface EnvironmentAware { +public interface EnvironmentAware extends Aware { /** * Set the {@code Environment} that this object runs in. diff --git a/org.springframework.context/src/main/java/org/springframework/context/MessageSourceAware.java b/org.springframework.context/src/main/java/org/springframework/context/MessageSourceAware.java index 3007e274189..00ab3cb21e4 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/MessageSourceAware.java +++ b/org.springframework.context/src/main/java/org/springframework/context/MessageSourceAware.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ package org.springframework.context; +import org.springframework.beans.factory.Aware; + /** * Interface to be implemented by any object that wishes to be notified * of the MessageSource (typically the ApplicationContext) that it runs in. @@ -25,10 +27,11 @@ package org.springframework.context; * it is defined as bean with name "messageSource" in the application context. * * @author Juergen Hoeller + * @author Chris Beams * @since 1.1.1 * @see ApplicationContextAware */ -public interface MessageSourceAware { +public interface MessageSourceAware extends Aware { /** * Set the MessageSource that this object runs in. diff --git a/org.springframework.context/src/main/java/org/springframework/context/ResourceLoaderAware.java b/org.springframework.context/src/main/java/org/springframework/context/ResourceLoaderAware.java index c95f8b964bf..3491cd047ba 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/ResourceLoaderAware.java +++ b/org.springframework.context/src/main/java/org/springframework/context/ResourceLoaderAware.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ package org.springframework.context; +import org.springframework.beans.factory.Aware; import org.springframework.core.io.ResourceLoader; /** @@ -47,6 +48,7 @@ import org.springframework.core.io.ResourceLoader; * automatic type conversion by the bean factory. * * @author Juergen Hoeller + * @author Chris Beams * @since 10.03.2004 * @see ApplicationContextAware * @see org.springframework.beans.factory.InitializingBean @@ -57,7 +59,7 @@ import org.springframework.core.io.ResourceLoader; * @see org.springframework.core.io.support.PathMatchingResourcePatternResolver * @see org.springframework.context.support.ReloadableResourceBundleMessageSource */ -public interface ResourceLoaderAware { +public interface ResourceLoaderAware extends Aware { /** * Set the ResourceLoader that this object runs in. diff --git a/org.springframework.context/src/main/java/org/springframework/context/support/ApplicationContextAwareProcessor.java b/org.springframework.context/src/main/java/org/springframework/context/support/ApplicationContextAwareProcessor.java index facb86ac515..7884251c4d6 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/support/ApplicationContextAwareProcessor.java +++ b/org.springframework.context/src/main/java/org/springframework/context/support/ApplicationContextAwareProcessor.java @@ -21,6 +21,7 @@ import java.security.AccessController; import java.security.PrivilegedAction; import org.springframework.beans.BeansException; +import org.springframework.beans.factory.Aware; import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.ApplicationContextAware; @@ -97,24 +98,26 @@ class ApplicationContextAwareProcessor implements BeanPostProcessor { } private void invokeAwareInterfaces(Object bean) { - if (bean instanceof EmbeddedValueResolverAware) { - ((EmbeddedValueResolverAware) bean).setEmbeddedValueResolver( - new EmbeddedValueResolver(this.applicationContext.getBeanFactory())); - } - if (bean instanceof ResourceLoaderAware) { - ((ResourceLoaderAware) bean).setResourceLoader(this.applicationContext); - } - if (bean instanceof ApplicationEventPublisherAware) { - ((ApplicationEventPublisherAware) bean).setApplicationEventPublisher(this.applicationContext); - } - if (bean instanceof MessageSourceAware) { - ((MessageSourceAware) bean).setMessageSource(this.applicationContext); - } - if (bean instanceof ApplicationContextAware) { - ((ApplicationContextAware) bean).setApplicationContext(this.applicationContext); - } - if (bean instanceof EnvironmentAware) { - ((EnvironmentAware) bean).setEnvironment(this.applicationContext.getEnvironment()); + if (bean instanceof Aware) { + if (bean instanceof EmbeddedValueResolverAware) { + ((EmbeddedValueResolverAware) bean).setEmbeddedValueResolver( + new EmbeddedValueResolver(this.applicationContext.getBeanFactory())); + } + if (bean instanceof ResourceLoaderAware) { + ((ResourceLoaderAware) bean).setResourceLoader(this.applicationContext); + } + if (bean instanceof ApplicationEventPublisherAware) { + ((ApplicationEventPublisherAware) bean).setApplicationEventPublisher(this.applicationContext); + } + if (bean instanceof MessageSourceAware) { + ((MessageSourceAware) bean).setMessageSource(this.applicationContext); + } + if (bean instanceof ApplicationContextAware) { + ((ApplicationContextAware) bean).setApplicationContext(this.applicationContext); + } + if (bean instanceof EnvironmentAware) { + ((EnvironmentAware) bean).setEnvironment(this.applicationContext.getEnvironment()); + } } } diff --git a/org.springframework.context/src/main/java/org/springframework/context/weaving/LoadTimeWeaverAware.java b/org.springframework.context/src/main/java/org/springframework/context/weaving/LoadTimeWeaverAware.java index 734251f0ded..c53250a999c 100644 --- a/org.springframework.context/src/main/java/org/springframework/context/weaving/LoadTimeWeaverAware.java +++ b/org.springframework.context/src/main/java/org/springframework/context/weaving/LoadTimeWeaverAware.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ package org.springframework.context.weaving; +import org.springframework.beans.factory.Aware; import org.springframework.instrument.classloading.LoadTimeWeaver; /** @@ -23,10 +24,11 @@ import org.springframework.instrument.classloading.LoadTimeWeaver; * of the application context's default {@link LoadTimeWeaver}. * * @author Juergen Hoeller + * @author Chris Beams * @since 2.5 * @see org.springframework.context.ConfigurableApplicationContext#LOAD_TIME_WEAVER_BEAN_NAME */ -public interface LoadTimeWeaverAware { +public interface LoadTimeWeaverAware extends Aware { /** * Set the {@link LoadTimeWeaver} of this object's containing diff --git a/org.springframework.context/src/main/java/org/springframework/jmx/export/notification/NotificationPublisherAware.java b/org.springframework.context/src/main/java/org/springframework/jmx/export/notification/NotificationPublisherAware.java index 8971c000426..b2e4dd4898c 100644 --- a/org.springframework.context/src/main/java/org/springframework/jmx/export/notification/NotificationPublisherAware.java +++ b/org.springframework.context/src/main/java/org/springframework/jmx/export/notification/NotificationPublisherAware.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ package org.springframework.jmx.export.notification; +import org.springframework.beans.factory.Aware; + /** * Interface to be implemented by any Spring-managed resource that is to be * registered with an {@link javax.management.MBeanServer} and wishes to send @@ -33,10 +35,11 @@ package org.springframework.jmx.export.notification; * interface (or implementing a full {@link javax.management.modelmbean.ModelMBean}). * * @author Rob Harrop + * @author Chris Beams * @since 2.0 * @see NotificationPublisher */ -public interface NotificationPublisherAware { +public interface NotificationPublisherAware extends Aware { /** * Set the {@link NotificationPublisher} instance for the current managed resource instance. diff --git a/org.springframework.transaction/src/main/java/org/springframework/jca/context/BootstrapContextAware.java b/org.springframework.transaction/src/main/java/org/springframework/jca/context/BootstrapContextAware.java index 93472df4d79..843609f922b 100644 --- a/org.springframework.transaction/src/main/java/org/springframework/jca/context/BootstrapContextAware.java +++ b/org.springframework.transaction/src/main/java/org/springframework/jca/context/BootstrapContextAware.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,16 +18,19 @@ package org.springframework.jca.context; import javax.resource.spi.BootstrapContext; +import org.springframework.beans.factory.Aware; + /** * Interface to be implemented by any object that wishes to be * notified of the BootstrapContext (typically determined by the * {@link ResourceAdapterApplicationContext}) that it runs in. * * @author Juergen Hoeller + * @author Chris Beams * @since 2.5 * @see javax.resource.spi.BootstrapContext */ -public interface BootstrapContextAware { +public interface BootstrapContextAware extends Aware { /** * Set the BootstrapContext that this object runs in. diff --git a/org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/context/PortletConfigAware.java b/org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/context/PortletConfigAware.java index 8b99a993e2e..2a3fee97f0f 100644 --- a/org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/context/PortletConfigAware.java +++ b/org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/context/PortletConfigAware.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,16 +18,19 @@ package org.springframework.web.portlet.context; import javax.portlet.PortletConfig; +import org.springframework.beans.factory.Aware; + /** * Interface to be implemented by any object that wishes to be notified * of the PortletConfig (typically determined by the PortletApplicationContext) * that it runs in. * * @author Juergen Hoeller + * @author Chris Beams * @since 2.0 * @see PortletContextAware */ -public interface PortletConfigAware { +public interface PortletConfigAware extends Aware { /** * Set the PortletConfigthat this object runs in. diff --git a/org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/context/PortletContextAware.java b/org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/context/PortletContextAware.java index 8e7a3445581..3fa1a56a6a4 100644 --- a/org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/context/PortletContextAware.java +++ b/org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/context/PortletContextAware.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,8 @@ package org.springframework.web.portlet.context; import javax.portlet.PortletContext; +import org.springframework.beans.factory.Aware; + /** * Interface to be implemented by any object that wishes to be notified * of the PortletContext (typically determined by the PortletApplicationContext) @@ -25,10 +27,11 @@ import javax.portlet.PortletContext; * * @author Juergen Hoeller * @author William G. Thompson, Jr. + * @author Chris Beams * @since 2.0 * @see PortletConfigAware */ -public interface PortletContextAware { +public interface PortletContextAware extends Aware { /** * Set the PortletContext that this object runs in. diff --git a/org.springframework.web/src/main/java/org/springframework/web/context/ServletConfigAware.java b/org.springframework.web/src/main/java/org/springframework/web/context/ServletConfigAware.java index 196e3db4346..16c71d33c5c 100644 --- a/org.springframework.web/src/main/java/org/springframework/web/context/ServletConfigAware.java +++ b/org.springframework.web/src/main/java/org/springframework/web/context/ServletConfigAware.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,8 @@ package org.springframework.web.context; import javax.servlet.ServletConfig; +import org.springframework.beans.factory.Aware; + /** * Interface to be implemented by any object that wishes to be notified * of the ServletConfig (typically determined by the WebApplicationContext) @@ -28,10 +30,11 @@ import javax.servlet.ServletConfig; * elsewhere, an exception will be thrown on bean creation. * * @author Juergen Hoeller + * @author Chris Beams * @since 2.0 * @see ServletContextAware */ -public interface ServletConfigAware { +public interface ServletConfigAware extends Aware { /** * Set the ServletConfig that this object runs in. diff --git a/org.springframework.web/src/main/java/org/springframework/web/context/ServletContextAware.java b/org.springframework.web/src/main/java/org/springframework/web/context/ServletContextAware.java index 16a6e709a96..02e599a615b 100644 --- a/org.springframework.web/src/main/java/org/springframework/web/context/ServletContextAware.java +++ b/org.springframework.web/src/main/java/org/springframework/web/context/ServletContextAware.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,16 +18,19 @@ package org.springframework.web.context; import javax.servlet.ServletContext; +import org.springframework.beans.factory.Aware; + /** * Interface to be implemented by any object that wishes to be notified * of the ServletContext (typically determined by the WebApplicationContext) * that it runs in. * * @author Juergen Hoeller + * @author Chris Beams * @since 12.03.2004 * @see ServletConfigAware */ -public interface ServletContextAware { +public interface ServletContextAware extends Aware { /** * Set the ServletContext that this object runs in.