01: /*
02: * Copyright 2002-2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: import org.springframework.beans.BeansException;
20:
21: /**
22: * Interface to be implemented by beans that wish to be aware of their
23: * owning {@link BeanFactory}.
24: *
25: * <p>For example, beans can look up collaborating beans via the factory
26: * (Dependency Lookup). Note that most beans will choose to receive references
27: * to collaborating beans via corresponding bean properties or constructor
28: * arguments (Dependency Injection).
29: *
30: * <p>For a list of all bean lifecycle methods, see the
31: * {@link BeanFactory BeanFactory javadocs}.
32: *
33: * @author Rod Johnson
34: * @since 11.03.2003
35: * @see BeanNameAware
36: * @see BeanClassLoaderAware
37: * @see InitializingBean
38: * @see org.springframework.context.ApplicationContextAware
39: */
40: public interface BeanFactoryAware {
41:
42: /**
43: * Callback that supplies the owning factory to a bean instance.
44: * <p>Invoked after the population of normal bean properties
45: * but before an initialization callback such as
46: * {@link InitializingBean#afterPropertiesSet()} or a custom init-method.
47: * @param beanFactory owning BeanFactory (never <code>null</code>).
48: * The bean can immediately call methods on the factory.
49: * @throws BeansException in case of initialization errors
50: * @see BeanInitializationException
51: */
52: void setBeanFactory(BeanFactory beanFactory) throws BeansException;
53:
54: }
|