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.

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3840 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Chris Beams
2011-01-03 10:13:57 +00:00
parent 1ac7b56caf
commit d00b49dca5
21 changed files with 144 additions and 62 deletions
@@ -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.