|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2012 the original author or authors. |
| 2 | + * Copyright 2002-2016 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
17 | 17 | package org.springframework.beans.factory;
|
18 | 18 |
|
19 | 19 | /**
|
20 |
| - * Interface to be implemented by objects used within a {@link BeanFactory} |
21 |
| - * which are themselves factories. If a bean implements this interface, |
22 |
| - * it is used as a factory for an object to expose, not directly as a bean |
23 |
| - * instance that will be exposed itself. |
| 20 | + * Interface to be implemented by objects used within a {@link BeanFactory} which |
| 21 | + * are themselves factories for individual objects. If a bean implements this |
| 22 | + * interface, it is used as a factory for an object to expose, not directly as a |
| 23 | + * bean instance that will be exposed itself. |
24 | 24 | *
|
25 |
| - * <p><b>NB: A bean that implements this interface cannot be used as a |
26 |
| - * normal bean.</b> A FactoryBean is defined in a bean style, but the |
27 |
| - * object exposed for bean references ({@link #getObject()} is always |
28 |
| - * the object that it creates. |
| 25 | + * <p><b>NB: A bean that implements this interface cannot be used as a normal bean.</b> |
| 26 | + * A FactoryBean is defined in a bean style, but the object exposed for bean |
| 27 | + * references ({@link #getObject()}) is always the object that it creates. |
29 | 28 | *
|
30 |
| - * <p>FactoryBeans can support singletons and prototypes, and can |
31 |
| - * either create objects lazily on demand or eagerly on startup. |
32 |
| - * The {@link SmartFactoryBean} interface allows for exposing |
33 |
| - * more fine-grained behavioral metadata. |
| 29 | + * <p>FactoryBeans can support singletons and prototypes, and can either create |
| 30 | + * objects lazily on demand or eagerly on startup. The {@link SmartFactoryBean} |
| 31 | + * interface allows for exposing more fine-grained behavioral metadata. |
34 | 32 | *
|
35 |
| - * <p>This interface is heavily used within the framework itself, for |
36 |
| - * example for the AOP {@link org.springframework.aop.framework.ProxyFactoryBean} |
37 |
| - * or the {@link org.springframework.jndi.JndiObjectFactoryBean}. |
38 |
| - * It can be used for application components as well; however, |
39 |
| - * this is not common outside of infrastructure code. |
| 33 | + * <p>This interface is heavily used within the framework itself, for example for |
| 34 | + * the AOP {@link org.springframework.aop.framework.ProxyFactoryBean} or the |
| 35 | + * {@link org.springframework.jndi.JndiObjectFactoryBean}. It can be used for |
| 36 | + * custom components as well; however, this is only common for infrastructure code. |
40 | 37 | *
|
41 |
| - * <p><b>NOTE:</b> FactoryBean objects participate in the containing |
42 |
| - * BeanFactory's synchronization of bean creation. There is usually no |
43 |
| - * need for internal synchronization other than for purposes of lazy |
44 |
| - * initialization within the FactoryBean itself (or the like). |
| 38 | + * <p><b>{@code FactoryBean} is a programmatic contract. Implementations are not |
| 39 | + * supposed to rely on annotation-driven injection or other reflective facilities.</b> |
| 40 | + * {@link #getObjectType()} {@link #getObject()} invocations may arrive early in |
| 41 | + * the bootstrap process, even ahead of any post-processor setup. If you need access |
| 42 | + * other beans, implement {@link BeanFactoryAware} and obtain them programmatically. |
| 43 | + * |
| 44 | + * <p>Finally, FactoryBean objects participate in the containing BeanFactory's |
| 45 | + * synchronization of bean creation. There is usually no need for internal |
| 46 | + * synchronization other than for purposes of lazy initialization within the |
| 47 | + * FactoryBean itself (or the like). |
45 | 48 | *
|
46 | 49 | * @author Rod Johnson
|
47 | 50 | * @author Juergen Hoeller
|
|
0 commit comments