|
44 | 44 | *
|
45 | 45 | * <h3>Bean Names</h3>
|
46 | 46 | *
|
47 |
| - * <p>While a {@link #name() name} attribute is available, the default strategy for |
| 47 | + * <p>While a {@link #name} attribute is available, the default strategy for |
48 | 48 | * determining the name of a bean is to use the name of the {@code @Bean} method.
|
49 | 49 | * This is convenient and intuitive, but if explicit naming is desired, the
|
50 |
| - * {@code name} attribute may be used. Also note that {@code name} accepts an array |
51 |
| - * of Strings. This is in order to allow for specifying multiple names (i.e., aliases) |
52 |
| - * for a single bean. |
| 50 | + * {@code name} attribute may be used. Also note that {@code name} accepts an |
| 51 | + * array of Strings, allowing for multiple names (i.e. a primary bean name plus |
| 52 | + * one or more aliases) for a single bean. |
53 | 53 | *
|
54 | 54 | * <pre class="code">
|
55 | 55 | * @Bean(name={"b1","b2"}) // bean available as 'b1' and 'b2', but not 'myBean'
|
|
78 | 78 | * <h3>{@code @Bean} Methods in {@code @Configuration} Classes</h3>
|
79 | 79 | *
|
80 | 80 | * <p>Typically, {@code @Bean} methods are declared within {@code @Configuration}
|
81 |
| - * classes. In this case, bean methods may reference other {@code @Bean} methods |
82 |
| - * in the same class by calling them <i>directly</i>. This ensures that references between |
83 |
| - * beans are strongly typed and navigable. Such so-called <em>'inter-bean references'</em> are |
| 81 | + * classes. In this case, bean methods may reference other {@code @Bean} methods in the |
| 82 | + * same class by calling them <i>directly</i>. This ensures that references between beans |
| 83 | + * are strongly typed and navigable. Such so-called <em>'inter-bean references'</em> are |
84 | 84 | * guaranteed to respect scoping and AOP semantics, just like {@code getBean()} lookups
|
85 | 85 | * would. These are the semantics known from the original 'Spring JavaConfig' project
|
86 | 86 | * which require CGLIB subclassing of each such configuration class at runtime. As a
|
|
190 | 190 | public @interface Bean {
|
191 | 191 |
|
192 | 192 | /**
|
193 |
| - * The name of this bean, or if plural, aliases for this bean. If left unspecified |
194 |
| - * the name of the bean is the name of the annotated method. If specified, the method |
195 |
| - * name is ignored. |
| 193 | + * The name of this bean, or if several names, a primary bean name plus aliases. |
| 194 | + * <p>If left unspecified, the name of the bean is the name of the annotated method. |
| 195 | + * If specified, the method name is ignored. |
196 | 196 | */
|
197 | 197 | String[] name() default {};
|
198 | 198 |
|
|
0 commit comments