Browse Source

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.
pull/7/head
Chris Beams 14 years ago
parent
commit
5e6912302a
  1. 39
      org.springframework.beans/src/main/java/org/springframework/beans/factory/Aware.java
  2. 5
      org.springframework.beans/src/main/java/org/springframework/beans/factory/BeanClassLoaderAware.java
  3. 5
      org.springframework.beans/src/main/java/org/springframework/beans/factory/BeanFactoryAware.java
  4. 5
      org.springframework.beans/src/main/java/org/springframework/beans/factory/BeanNameAware.java
  5. 21
      org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java
  6. 1
      org.springframework.beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java
  7. 6
      org.springframework.context.support/src/main/java/org/springframework/scheduling/quartz/SchedulerContextAware.java
  8. 6
      org.springframework.context/src/main/java/org/springframework/context/ApplicationContextAware.java
  9. 7
      org.springframework.context/src/main/java/org/springframework/context/ApplicationEventPublisherAware.java
  10. 6
      org.springframework.context/src/main/java/org/springframework/context/EmbeddedValueResolverAware.java
  11. 5
      org.springframework.context/src/main/java/org/springframework/context/EnvironmentAware.java
  12. 7
      org.springframework.context/src/main/java/org/springframework/context/MessageSourceAware.java
  13. 6
      org.springframework.context/src/main/java/org/springframework/context/ResourceLoaderAware.java
  14. 39
      org.springframework.context/src/main/java/org/springframework/context/support/ApplicationContextAwareProcessor.java
  15. 6
      org.springframework.context/src/main/java/org/springframework/context/weaving/LoadTimeWeaverAware.java
  16. 7
      org.springframework.context/src/main/java/org/springframework/jmx/export/notification/NotificationPublisherAware.java
  17. 7
      org.springframework.transaction/src/main/java/org/springframework/jca/context/BootstrapContextAware.java
  18. 7
      org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/context/PortletConfigAware.java
  19. 7
      org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/context/PortletContextAware.java
  20. 7
      org.springframework.web/src/main/java/org/springframework/web/context/ServletConfigAware.java
  21. 7
      org.springframework.web/src/main/java/org/springframework/web/context/ServletContextAware.java

39
org.springframework.beans/src/main/java/org/springframework/beans/factory/Aware.java

@ -0,0 +1,39 @@ @@ -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.
*
* <p>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 {
}

5
org.springframework.beans/src/main/java/org/springframework/beans/factory/BeanClassLoaderAware.java

@ -1,5 +1,5 @@ @@ -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; @@ -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

5
org.springframework.beans/src/main/java/org/springframework/beans/factory/BeanFactoryAware.java

@ -1,5 +1,5 @@ @@ -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; @@ -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.

5
org.springframework.beans/src/main/java/org/springframework/beans/factory/BeanNameAware.java

@ -1,5 +1,5 @@ @@ -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; @@ -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.

21
org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java

@ -48,6 +48,7 @@ import org.springframework.beans.PropertyAccessorUtils; @@ -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 @@ -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);
}
}
}

1
org.springframework.beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java

@ -203,7 +203,6 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto @@ -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;

6
org.springframework.context.support/src/main/java/org/springframework/scheduling/quartz/SchedulerContextAware.java

@ -1,5 +1,5 @@ @@ -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 @@ @@ -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; @@ -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.

6
org.springframework.context/src/main/java/org/springframework/context/ApplicationContextAware.java

@ -1,5 +1,5 @@ @@ -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 @@ @@ -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; @@ -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.

7
org.springframework.context/src/main/java/org/springframework/context/ApplicationEventPublisherAware.java

@ -1,5 +1,5 @@ @@ -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 @@ @@ -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.

6
org.springframework.context/src/main/java/org/springframework/context/EmbeddedValueResolverAware.java

@ -1,5 +1,5 @@ @@ -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 @@ @@ -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; @@ -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.

5
org.springframework.context/src/main/java/org/springframework/context/EnvironmentAware.java

@ -1,5 +1,5 @@ @@ -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 @@ @@ -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; @@ -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.

7
org.springframework.context/src/main/java/org/springframework/context/MessageSourceAware.java

@ -1,5 +1,5 @@ @@ -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 @@ @@ -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; @@ -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.

6
org.springframework.context/src/main/java/org/springframework/context/ResourceLoaderAware.java

@ -1,5 +1,5 @@ @@ -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 @@ @@ -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; @@ -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; @@ -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.

39
org.springframework.context/src/main/java/org/springframework/context/support/ApplicationContextAwareProcessor.java

@ -21,6 +21,7 @@ import java.security.AccessController; @@ -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 { @@ -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());
}
}
}

6
org.springframework.context/src/main/java/org/springframework/context/weaving/LoadTimeWeaverAware.java

@ -1,5 +1,5 @@ @@ -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 @@ @@ -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; @@ -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

7
org.springframework.context/src/main/java/org/springframework/jmx/export/notification/NotificationPublisherAware.java

@ -1,5 +1,5 @@ @@ -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 @@ @@ -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; @@ -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.

7
org.springframework.transaction/src/main/java/org/springframework/jca/context/BootstrapContextAware.java

@ -1,5 +1,5 @@ @@ -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; @@ -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.

7
org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/context/PortletConfigAware.java

@ -1,5 +1,5 @@ @@ -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; @@ -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.

7
org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/context/PortletContextAware.java

@ -1,5 +1,5 @@ @@ -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; @@ -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; @@ -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.

7
org.springframework.web/src/main/java/org/springframework/web/context/ServletConfigAware.java

@ -1,5 +1,5 @@ @@ -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; @@ -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; @@ -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.

7
org.springframework.web/src/main/java/org/springframework/web/context/ServletContextAware.java

@ -1,5 +1,5 @@ @@ -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; @@ -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.

Loading…
Cancel
Save