|
77 | 77 | * <p>Typically, {@code @Bean} methods are declared within {@code @Configuration}
|
78 | 78 | * classes. In this case, bean methods may reference other {@code @Bean} methods
|
79 | 79 | * in the same class by calling them <i>directly</i>. This ensures that references between
|
80 |
| - * beans are strongly typed and navigable. Such so-called 'inter-bean references' are |
| 80 | + * beans are strongly typed and navigable. Such so-called <em>'inter-bean references'</em> are |
81 | 81 | * guaranteed to respect scoping and AOP semantics, just like <code>getBean()</code> lookups
|
82 | 82 | * would. These are the semantics known from the original 'Spring JavaConfig' project
|
83 | 83 | * which require CGLIB subclassing of each such configuration class at runtime. As a
|
|
105 | 105 | * in a {@code @Component} class or even in a <em>plain old class</em>. In such cases,
|
106 | 106 | * a {@code @Bean} method will get processed in a so-called <em>'lite'</em> mode.
|
107 | 107 | *
|
108 |
| - * <p>In contrast to the semantics for bean methods in {@code @Configuration} classes |
109 |
| - * as described above, bean methods in <em>lite</em> mode will be called as plain |
110 |
| - * <em>factory methods</em> from the container (similar to {@code factory-method} |
111 |
| - * declarations in XML) but with <b><em>prototype</em></b> semantics. The containing |
| 108 | + * <p>Bean methods in <em>lite</em> mode will be treated as plain <em>factory |
| 109 | + * methods</em> by the container (similar to {@code factory-method} declarations |
| 110 | + * in XML), with scoping and lifecycle callbacks properly applied. The containing |
112 | 111 | * class remains unmodified in this case, and there are no unusual constraints for
|
113 |
| - * factory methods; however, scoping semantics are <b>not</b> respected as described |
114 |
| - * above for 'inter-bean method' invocations in this mode. For example: |
| 112 | + * the containing class or the factory methods. |
| 113 | + * |
| 114 | + * <p>In contrast to the semantics for bean methods in {@code @Configuration} classes, |
| 115 | + * <em>'inter-bean references'</em> are not supported in <em>lite</em> mode. Instead, |
| 116 | + * when one {@code @Bean}-method invokes another {@code @Bean}-method in <em>lite</em> |
| 117 | + * mode, the invocation is a standard Java method invocation; Spring does not intercept |
| 118 | + * the invocation via a CGLIB proxy. This is analogous to inter-{@code @Transactional} |
| 119 | + * method calls where in proxy mode, Spring does not intercept the invocation — |
| 120 | + * Spring does so only in AspectJ mode. |
| 121 | + * |
| 122 | + * <p>For example: |
115 | 123 | *
|
116 | 124 | * <pre class="code">
|
117 | 125 | * @Component
|
|
0 commit comments