@@ -306,23 +306,23 @@ Typically, such configuration will live in a ".groovy" file with a structure as
306
306
[source,java,indent=0]
307
307
[subs="verbatim,quotes"]
308
308
----
309
- beans {
310
- dataSource(BasicDataSource) {
311
- driverClassName = "org.hsqldb.jdbcDriver"
312
- url = "jdbc:hsqldb:mem:grailsDB"
313
- username = "sa"
314
- password = ""
315
- settings = [mynew:"setting"]
316
- }
317
- sessionFactory(SessionFactory) {
318
- dataSource = dataSource
319
- }
320
- myService(MyService) {
321
- nestedBean = { AnotherBean bean ->
322
- dataSource = dataSource
323
- }
324
- }
325
- }
309
+ beans {
310
+ dataSource(BasicDataSource) {
311
+ driverClassName = "org.hsqldb.jdbcDriver"
312
+ url = "jdbc:hsqldb:mem:grailsDB"
313
+ username = "sa"
314
+ password = ""
315
+ settings = [mynew:"setting"]
316
+ }
317
+ sessionFactory(SessionFactory) {
318
+ dataSource = dataSource
319
+ }
320
+ myService(MyService) {
321
+ nestedBean = { AnotherBean bean ->
322
+ dataSource = dataSource
323
+ }
324
+ }
325
+ }
326
326
----
327
327
328
328
This configuration style is largely equivalent to XML bean definitions and even
@@ -4469,17 +4469,17 @@ The same applies for typed collections:
4469
4469
====
4470
4470
Your target beans can implement the `org.springframework.core.Ordered` interface or use
4471
4471
the `@Order` or standard `@Priority` annotation if you want items in the array or list
4472
- to be sorted into a specific order. Otherwise their order will follow the registration
4472
+ to be sorted in a specific order. Otherwise their order will follow the registration
4473
4473
order of the corresponding target bean definitions in the container.
4474
4474
4475
4475
The `@Order` annotation may be declared at target class level but also on `@Bean` methods,
4476
4476
potentially being very individual per bean definition (in case of multiple definitions
4477
- with the same bean class). `@Order` values may influence priorities at injection points
4477
+ with the same bean class). `@Order` values may influence priorities at injection points,
4478
4478
but please be aware that they do not influence singleton startup order which is an
4479
4479
orthogonal concern determined by dependency relationships and `@DependsOn` declarations.
4480
4480
4481
4481
Note that the standard `javax.annotation.Priority` annotation is not available at the
4482
- `@Bean` level since it cannot be declared on methods. Its semantics can be modelled
4482
+ `@Bean` level since it cannot be declared on methods. Its semantics can be modeled
4483
4483
through `@Order` values in combination with `@Primary` on a single bean per type.
4484
4484
====
4485
4485
@@ -5731,10 +5731,10 @@ Spring stereotype annotation (`@Component`, `@Repository`, `@Service`, and
5731
5731
`@Controller`) that contains a _name_ `value` will thereby provide that name to the
5732
5732
corresponding bean definition.
5733
5733
5734
- If such an annotation contains no _name_ `value` or for any other detected component (such
5735
- as those discovered by custom filters), the default bean name generator returns the
5736
- uncapitalized non-qualified class name. For example, if the following two components
5737
- were detected, the names would be `myMovieLister` and `movieFinderImpl`:
5734
+ If such an annotation contains no _name_ `value` or for any other detected component
5735
+ (such as those discovered by custom filters), the default bean name generator returns
5736
+ the uncapitalized non-qualified class name. For example, if the following component
5737
+ classes were detected, the names would be `myMovieLister` and `movieFinderImpl`:
5738
5738
5739
5739
[source,java,indent=0]
5740
5740
[subs="verbatim,quotes"]
@@ -5793,8 +5793,8 @@ auto-generated names are adequate whenever the container is responsible for wiri
5793
5793
5794
5794
As with Spring-managed components in general, the default and most common scope for
5795
5795
autodetected components is `singleton`. However, sometimes you need a different scope
5796
- which can be specified via the `@Scope` annotation. Simply provide the name of the scope
5797
- within the annotation:
5796
+ which can be specified via the `@Scope` annotation. Simply provide the name of the
5797
+ scope within the annotation:
5798
5798
5799
5799
[source,java,indent=0]
5800
5800
[subs="verbatim,quotes"]
@@ -5806,8 +5806,19 @@ within the annotation:
5806
5806
}
5807
5807
----
5808
5808
5809
- For details on web-specific scopes, see <<beans-factory-scopes-other>>.
5809
+ [NOTE]
5810
+ ====
5811
+ `@Scope` annotations are only introspected on the concrete bean class (for annotated
5812
+ components) or the factory method (for `@Bean` methods). In contrast to XML bean
5813
+ definitions, there is no notion of bean definition inheritance, and inheritance
5814
+ hierarchies at the class level are irrelevant for metadata purposes.
5815
+ ====
5810
5816
5817
+ For details on web-specific scopes such as "request"/"session" in a Spring context,
5818
+ see <<beans-factory-scopes-other>>. Like the pre-built annotations for those scopes,
5819
+ you may also compose your own scoping annotations using Spring's meta-annotation
5820
+ approach: e.g. a custom annotation meta-annotated with `@Scope("prototype")`,
5821
+ possibly also declaring a custom scoped-proxy mode.
5811
5822
5812
5823
[NOTE]
5813
5824
====
@@ -5832,8 +5843,7 @@ fully-qualified class name when configuring the scanner:
5832
5843
[subs="verbatim,quotes"]
5833
5844
----
5834
5845
<beans>
5835
- <context:component-scan base-package="org.example"
5836
- scope-resolver="org.example.MyScopeResolver" />
5846
+ <context:component-scan base-package="org.example" scope-resolver="org.example.MyScopeResolver"/>
5837
5847
</beans>
5838
5848
----
5839
5849
@@ -5857,8 +5867,7 @@ the following configuration will result in standard JDK dynamic proxies:
5857
5867
[subs="verbatim,quotes"]
5858
5868
----
5859
5869
<beans>
5860
- <context:component-scan base-package="org.example"
5861
- scoped-proxy="interfaces" />
5870
+ <context:component-scan base-package="org.example" scoped-proxy="interfaces"/>
5862
5871
</beans>
5863
5872
----
5864
5873
@@ -7976,6 +7985,15 @@ be resolved to the corresponding value. If not, then "default/path" will be used
7976
7985
as a default. If no default is specified and a property cannot be resolved, an
7977
7986
`IllegalArgumentException` will be thrown.
7978
7987
7988
+ [NOTE]
7989
+ ====
7990
+ The `@PropertySource` annotation is repeatable according to Java 8 conventions.
7991
+ However, all such `@PropertySource` annotations need to be declared at the same
7992
+ level: either directly on the configuration class or as meta-annotations within the
7993
+ same custom annotation. Mixing of direct annotations and meta-annotations is not
7994
+ recommended since direct annotations will effectively override meta-annotations.
7995
+ ====
7996
+
7979
7997
7980
7998
7981
7999
=== Placeholder resolution in statements
0 commit comments