Home » Spring-Framework-090522 » org.springframework » beans » factory » [javadoc | source]

    1   /*
    2    * Copyright 2002-2007 the original author or authors.
    3    *
    4    * Licensed under the Apache License, Version 2.0 (the "License");
    5    * you may not use this file except in compliance with the License.
    6    * You may obtain a copy of the License at
    7    *
    8    *      http://www.apache.org/licenses/LICENSE-2.0
    9    *
   10    * Unless required by applicable law or agreed to in writing, software
   11    * distributed under the License is distributed on an "AS IS" BASIS,
   12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   13    * See the License for the specific language governing permissions and
   14    * limitations under the License.
   15    */
   16   
   17   package org.springframework.beans.factory;
   18   
   19   /**
   20    * Interface to be implemented by beans that want to be aware of their
   21    * bean name in a bean factory. Note that it is not usually recommended
   22    * that an object depend on its bean name, as this represents a potentially
   23    * brittle dependence on external configuration, as well as a possibly
   24    * unnecessary dependence on a Spring API.
   25    *
   26    * <p>For a list of all bean lifecycle methods, see the
   27    * {@link BeanFactory BeanFactory javadocs}.
   28    *
   29    * @author Juergen Hoeller
   30    * @since 01.11.2003
   31    * @see BeanClassLoaderAware
   32    * @see BeanFactoryAware
   33    * @see InitializingBean
   34    */
   35   public interface BeanNameAware {
   36   
   37   	/**
   38   	 * Set the name of the bean in the bean factory that created this bean.
   39   	 * <p>Invoked after population of normal bean properties but before an
   40   	 * init callback such as {@link InitializingBean#afterPropertiesSet()}
   41   	 * or a custom init-method.
   42   	 * @param name the name of the bean in the factory.
   43   	 * Note that this name is the actual bean name used in the factory, which may
   44   	 * differ from the originally specified name: in particular for inner bean
   45   	 * names, the actual bean name might have been made unique through appending
   46   	 * "#..." suffixes. Use the {@link BeanFactoryUtils#originalBeanName(String)}
   47   	 * method to extract the original bean name (without suffix), if desired.
   48   	 */
   49   	void setBeanName(String name);
   50   
   51   }

Home » Spring-Framework-090522 » org.springframework » beans » factory » [javadoc | source]