Commit Graph

1383 Commits

Author SHA1 Message Date
Sam Brannen
ff104b6de0 Look up @Component stereotype names using @AliasFor semantics
Although gh-20615 introduced the use of @AliasFor for @Component(value) in the built-in
stereotype annotations (@Service, @Controller, @Repository, @Configuration, and
@RestController), prior to this commit the framework did not actually rely on @AliasFor
support when looking up a component name via stereotype annotations. Rather, the
framework had custom annotation parsing logic in
AnnotationBeanNameGenerator#determineBeanNameFromAnnotation() which effectively ignored
explicit annotation attribute overrides configured via @AliasFor.

This commit revises AnnotationBeanNameGenerator#determineBeanNameFromAnnotation() so that
it first looks up @Component stereotype names using @AliasFor semantics before falling
back to the "convention-based" component name lookup strategy.

Consequently, the name of the annotation attribute that is used to specify the bean name
is no longer required to be `value`, and custom stereotype annotations can now declare an
attribute with a different name (such as `name`) and annotate that attribute with
`@AliasFor(annotation = Component.class, attribute = "value")`.

Closes gh-31089
2023-08-27 17:17:52 +02:00
Sam Brannen
e1826d2322 Reinstate support for @javax.annotation.ManagedBean & @javax.inject.Named
This commit reinstates support for the legacy JSR-250
@javax.annotation.ManagedBean and JSR-330 @javax.inject.Named
annotations with regard to component name lookups and component
scanning.

Closes gh-31090
2023-08-26 17:16:00 +02:00
Sam Brannen
aaa0a2be63 Test status quo for @Components with multiple declared names 2023-08-26 17:15:47 +02:00
Sam Brannen
71ba7bc5e0 Polishing 2023-08-26 17:15:39 +02:00
Stephane Nicoll
2b76c4d847 Polish "Wrap ternary operator within parentheses"
See gh-31076
2023-08-22 15:40:16 +02:00
Sam Brannen
aedd909ef6 Test status quo for component name lookups for Jakarta annotations 2023-08-22 11:49:08 +02:00
Sam Brannen
d8523cb033 Polishing 2023-08-22 11:49:08 +02:00
Sam Brannen
74130d007b Ensure direct @PropertySource annotations override meta-annotations
Prior to this commit, there was an issue with the semantics of property
source overrides. Specifically, a @PropertySource annotation present as
a meta-annotation on a @Configuration class was registered with higher
precedence than a @PropertySource annotation declared closer to (or
directly on) the @Configuration class. Consequently, there was no way
for a "local" @PropertySource annotation to override properties
registered via @PropertySource as a meta-annotation.

This commit addresses this issue by introducing a new overloaded
getMergedRepeatableAnnotationAttributes() variant in
AnnotatedTypeMetadata that allows the caller to supply a
sortByReversedMetaDistance flag. When set to `true`, the annotation
search results will be sorted in reversed order based on each
annotation's meta distance, which effectively orders meta-annotations
before annotations that are declared directly on the underlying element.

ConfigurationClassParser and AnnotationConfigUtils have been updated to
use this new repeatable annotation search method for @PropertySource.

Closes gh-31074
2023-08-18 16:43:44 +02:00
Sam Brannen
ee6998ba52 Polishing 2023-08-18 16:21:50 +02:00
Juergen Hoeller
e685ff0416 Always accept existing explicit definition for same class name
See gh-25952
2023-08-16 18:46:32 +02:00
Juergen Hoeller
57f675c537 Allow @Bean method to override scanned class matching its return type
Closes gh-31052
2023-08-15 13:55:57 +02:00
Sam Brannen
443e3d5fa6 Polishing 2023-08-14 19:48:32 +02:00
Juergen Hoeller
9c74c25961 Support for resource patterns in @PropertySource locations
Closes gh-21325
2023-08-14 19:16:52 +02:00
Sam Brannen
1a05ba3215 Polishing 2023-08-13 12:18:26 +02:00
Sam Brannen
3bda2b7124 Find all @ComponentScan and @PropertySource annotations
Prior to this commit, Spring failed to find multiple composed
@ComponentScan and @PropertySource annotations or multiple
@ComponentScans and @PropertySources container annotations. The reason
was due to lacking support in the AnnotatedTypeMetadata API.

This commit introduces support for finding all @ComponentScan and
@PropertySource annotations by making use of the new
getMergedRepeatableAnnotationAttributes() method in
AnnotatedTypeMetadata.

Closes gh-30941
See gh-31041
2023-08-13 11:33:32 +02:00
Juergen Hoeller
f516431260 Merge branch '6.0.x' 2023-08-09 23:54:30 +02:00
Juergen Hoeller
d254bff197 Polishing 2023-08-09 23:53:40 +02:00
Juergen Hoeller
8e16e5ea35 Revise StopWatch for flexible time units in nanosecond precision
Closes gh-25803
2023-08-08 01:48:58 +02:00
Juergen Hoeller
d3d414c3c7 Reject @Bean method with void return type
Closes gh-31007
2023-08-07 15:00:08 +02:00
Juergen Hoeller
6e5af9dccb Polishing 2023-08-06 14:25:39 +02:00
Juergen Hoeller
eaf54b54c3 Detect illegal bean definition override during classpath scanning
Closes gh-25952
2023-08-06 14:03:29 +02:00
Sam Brannen
376f13f8ef Update copyright headers 2023-08-04 15:02:41 +03:00
Juergen Hoeller
4b6fabbd2f Polishing 2023-08-03 18:10:13 +02:00
Juergen Hoeller
84b3335e71 Apply array editor to collection of same element type as well
Closes gh-24845
2023-08-03 17:55:54 +02:00
Juergen Hoeller
c3e18bc173 Retain metadata during bean creation even with cacheBeanMetadata=false
Closes gh-23795
Closes gh-25749
2023-08-03 17:55:47 +02:00
Sébastien Deleuze
c942c04aa0 Support resource bundle custom file extensions
This commit allows to configure custom file
extensions in ReloadableResourceBundleMessageSource
thanks to a new setFileExtensions setter.

Combined with setPropertiesPersister, it allows
custom implementations supporting any kind of
property file.

Closes gh-18990
2023-08-03 14:29:29 +02:00
Juergen Hoeller
52176edcbf Polishing 2023-08-02 00:06:49 +02:00
Juergen Hoeller
a9d100eeee Support for always executing specific listeners in original thread
See gh-30244
2023-08-01 23:26:35 +02:00
Juergen Hoeller
ce80637891 Add option for graceful shutdown (setTaskTerminationTimeout)
See gh-30956
2023-07-27 21:39:58 +02:00
Juergen Hoeller
7681200ee7 Introduce SimpleAsyncTaskScheduler (extending SimpleAsyncTaskExecutor)
Closes gh-30956
2023-07-26 23:56:59 +02:00
rstoyanchev
67e3d86bd8 Support declarativeBinding mode in DataBinder
Closes gh-30948
2023-07-25 18:04:21 +03:00
rstoyanchev
37eaded63d Support BindParam annotation
Allows customizing the name of the request parameter to bind a
constructor parameter to.

Closes gh-30947
2023-07-25 16:15:55 +03:00
Juergen Hoeller
4ce1ac0dcb Polishing 2023-07-21 20:36:43 +02:00
Juergen Hoeller
f99faac073 Add caching annotation support for CompletableFuture and reactive return values
Includes CompletableFuture-based retrieve operations on Spring's Cache interface.
Includes support for retrieve operations on CaffeineCache and ConcurrentMapCache.
Includes async cache mode option on CaffeineCacheManager.

Closes gh-17559
Closes gh-17920
Closes gh-30122
2023-07-21 20:27:23 +02:00
Juergen Hoeller
391d7f2c6a Polishing 2023-07-19 22:47:20 +02:00
Juergen Hoeller
10cb2322e9 Introduce Validator.validateObject(Object) with returned Errors
Includes failOnError method on Errors interface for use with validateObject.
Declares many Errors methods as default methods for lean SimpleErrors class.

Closes gh-19877
2023-07-19 21:56:44 +02:00
Juergen Hoeller
2ac55659c8 Merge branch '6.0.x' 2023-07-19 01:26:05 +02:00
Juergen Hoeller
c64a322e19 Polishing 2023-07-19 01:25:20 +02:00
Juergen Hoeller
33862d98ea Merge branch '6.0.x' 2023-07-18 22:03:03 +02:00
Juergen Hoeller
bbcc788f60 Decouple exception messages for sync=true from @Cacheable 2023-07-18 22:02:09 +02:00
Juergen Hoeller
c504ac5a47 Merge branch '6.0.x' 2023-07-18 12:57:18 +02:00
Juergen Hoeller
616f728afa MethodIntrospector handles overriding bridge method correctly
Closes gh-30906
2023-07-18 12:54:59 +02:00
Sam Brannen
a34f9fa66c Update copyright headers 2023-07-15 13:10:46 +02:00
Sam Brannen
5ce8ffd197 Merge branch '6.0.x' 2023-07-15 13:11:03 +02:00
Sam Brannen
8629182822 Suppress deprecation warnings in tests 2023-07-15 12:16:38 +02:00
Juergen Hoeller
fd17df91fd Merge branch '6.0.x'
# Conflicts:
#	spring-jdbc/src/main/java/org/springframework/jdbc/support/AbstractFallbackSQLExceptionTranslator.java
2023-07-14 14:38:24 +02:00
Juergen Hoeller
384246c360 Polishing 2023-07-14 14:37:34 +02:00
Sam Brannen
16b9640af2 Merge branch '6.0.x' 2023-07-12 11:50:11 +02:00
Sam Brannen
68f2b0ca59 Rely on auto-boxing in tests 2023-07-12 11:49:02 +02:00
Sam Brannen
18c11e84f3 Merge branch '6.0.x' 2023-07-12 10:34:43 +02:00