01: /*
02: * Copyright 2002-2005 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: /**
20: * Interface to be implemented by beans that need to react once all their
21: * properties have been set by a BeanFactory: for example, to perform custom
22: * initialization, or merely to check that all mandatory properties have been set.
23: *
24: * <p>An alternative to implementing InitializingBean is specifying a custom
25: * init-method, for example in an XML bean definition.
26: * For a list of all bean lifecycle methods, see the BeanFactory javadocs.
27: *
28: * @author Rod Johnson
29: * @see BeanNameAware
30: * @see BeanFactoryAware
31: * @see BeanFactory
32: * @see org.springframework.beans.factory.support.RootBeanDefinition#getInitMethodName
33: * @see org.springframework.context.ApplicationContextAware
34: */
35: public interface InitializingBean {
36:
37: /**
38: * Invoked by a BeanFactory after it has set all bean properties supplied
39: * (and satisfied BeanFactoryAware and ApplicationContextAware).
40: * <p>This method allows the bean instance to perform initialization only
41: * possible when all bean properties have been set and to throw an
42: * exception in the event of misconfiguration.
43: * @throws Exception in the event of misconfiguration (such
44: * as failure to set an essential property) or if initialization fails.
45: */
46: void afterPropertiesSet() throws Exception;
47:
48: }
|