Commit Graph

2425 Commits

Author SHA1 Message Date
Sam Brannen 161c9dc3bd Improve @Cacheable documentation regarding java.util.Optional
This commit improves the documentation for @Cacheable to point out that
`null` will be stored in the cache for an empty `Optional` return value.

Closes gh-27184
2021-07-27 15:05:43 +02:00
Juergen Hoeller 62e916534f Introduce remaining policy setters from ScheduledThreadPoolExecutor
Closes gh-26719
2021-07-13 09:27:48 +02:00
Juergen Hoeller d3b1c4f62b Code alignment between ThreadPoolTaskExecutor and ThreadPoolTaskScheduler
See gh-26700
2021-07-09 15:19:25 +02:00
Filip Hrisafov 531174258c Apply dynamic changes in ThreadPoolTaskExecutor before setting local value
If the ThreadPoolTaskExecutor is dynamically changed with an invalid value
the state of the ThreadPoolTaskExecutor does no longer correctly represent
the state of the underlying ThreadPoolExecutor
2021-07-09 15:10:55 +02:00
Juergen Hoeller 8680fdb8bc Polishing 2021-07-09 13:26:46 +02:00
Juergen Hoeller c45c46dad7 Make proxyTargetClass=true with introduction advice work for JDK proxy targets
Closes gh-27044
2021-07-09 13:23:04 +02:00
Arjen Poutsma 76b1c0f1fc Various bug fixes in CronExpression
This commit makes various bug fixes in CronExpression and related files.

Closes gh-27136
2021-07-07 10:56:07 +02:00
Stephane Nicoll b0f724a597 Update copyright year of changed file
See gh-27105
2021-06-29 19:27:57 +02:00
takumi34 9add04f800 Fix typo in BeanDefinitionDsl.kt
See gh-27105
2021-06-29 19:27:29 +02:00
Sam Brannen a2ef6badc4 Use StringBuilder.append(char) where possible
To slightly improve performance, this commit switches to
StringBuilder.append(char) instead of StringBuilder.append(String)
whenever we append a single character to a StringBuilder.

Closes gh-27098
2021-06-25 10:44:28 +02:00
Sam Brannen 2bc7a3aa0a Implement equals, hashCode, & toString in BeanMethod and *Metadata types
Prior to this commit, ConfigurationClass implemented equals(),
hashCode(), and toString(), but BeanMethod did not.

This commit introduces equals(), hashCode(), and toString()
implementations in BeanMethod for consistency with ConfigurationClass
to make it possible to use BeanMethod instances to index additional
metadata as well.

In order to properly implement equals() in BeanMethod, the method
argument types are required, but these are not directly available in
BeanMethod. However, they are available via ASM when processing @Bean
methods. This commit therefore implements equals(), hashCode(), and
toString() in SimpleMethodMetadata which BeanMethod delegates to.

For completeness, this commit also implements equals(), hashCode(), and
toString() in StandardClassMetadata, StandardMethodMetadata, and
SimpleAnnotationMetadata.

Closes gh-27076
2021-06-24 16:41:28 +02:00
Sam Brannen 1bc236785c Polishing 2021-06-24 15:47:24 +02:00
Sam Brannen d469f6215d Polishing 2021-06-22 19:54:05 +02:00
Sam Brannen a8102e6a41 Delete unused code in ConfigurationMethod 2021-06-21 18:31:43 +02:00
duan847 3c8074b669
Fix assertion in XmlBeanFactoryTests
Closes gh-27058
2021-06-14 18:49:55 +02:00
Juergen Hoeller 23f396a231 Nullability refinements 2021-06-08 14:23:06 +02:00
Arjen Poutsma 6f2fe5ddcb (Re)introduce CronExpression::isValidExpression
This commit introduces CronExpression::isValidExpression, which was also
present on the deprecated CronSequenceGenerator.

Closes: gh-26996
2021-05-31 14:28:55 +02:00
Arjen Poutsma 4203e90655 Fix CronExpression roll-forward issue
This commit makes sure that BitsCronField rolls the date forward in
cases where we cannot find a next bit to elapse to.

Closes: gh-26964
2021-05-26 16:46:15 +02:00
Sam Brannen 1e2e114e3c Polish contribution
See gh-26871
2021-05-26 14:46:32 +02:00
Michael Edwards 0e73213144
Add ApplicationEvent constructor for specifying timestamp
Closes gh-26871
2021-05-26 14:32:41 +02:00
Sam Brannen 1e1045ba42 Doc tx semantics for @TransactionalEventListener after completion phases
This commit improves the Javadoc regarding transactional semantics for
@TransactionalEventListener methods invoked in the AFTER_COMMIT,
AFTER_ROLLBACK, or AFTER_COMPLETION phase. Specifically, the
documentation now points out that interactions with the underlying
transactional resource will not be committed in those phases.

Closes gh-26974
2021-05-26 14:21:08 +02:00
Sam Brannen 1acd832759 Fix link in @EventListener's `id` Javadoc 2021-05-16 15:08:33 +02:00
Juergen Hoeller 1469bdbc70 Nullability refinements and related polishing 2021-05-11 16:50:19 +02:00
Juergen Hoeller 90af2d5794 Log delegate service initialization at debug level (instead of info)
Closes gh-26810
2021-05-11 15:46:41 +02:00
Sam Brannen 7316dc726a Polish Javadoc for MessageSourceSupport
See gh-26874
2021-04-29 17:49:29 +02:00
Sviatoslav Hryb 118c7f969b
Improve readability of MessageSourceSupport Javadoc
Closes gh-26874
2021-04-29 17:42:41 +02:00
Johnny Lim 98770b15e7
Polishing
Closes gh-26878
2021-04-29 16:53:53 +02:00
Stephane Nicoll 607d918340 Provide nested cause when a suitable CacheManager cannot be found
Closes gh-25250
2021-04-29 08:48:34 +02:00
Christoph Dreis e7cbe23771 Avoid exceptions when evaluating validation hints
Prior to this commit, evaluating validation hints for
@javax.validation.Valid caused exceptions being raised when getting the
value of this annotation, which does not exist. Bypassing
AnnotationUtils.getValue() in those cases can improve performance by
avoiding the cost incurred by raising exceptions.

See gh-26787
2021-04-22 11:19:30 +02:00
Arjen Poutsma 27bfcbbc82 Fix daylight saving issue in CronExpression
Closes gh-26830
2021-04-21 12:04:21 +02:00
Sam Brannen 71158f4d96 Polishing
See gh-26825
2021-04-20 18:56:18 +02:00
Sviatoslav Hryb 7303680369
Remove reference to deprecated Joda Time support in @DateTimeFormat Javadoc
Closes gh-26825
2021-04-20 18:54:34 +02:00
Sam Brannen 906a1f561a Polish CronTriggerTests and assess daylight savings time issue
This test polishes CronTriggerTests and modifies the
daylightSavingMissingHour() test to help analyze why the test fails
for CET if the minute value for the last completion time falls between
0 and 9 minutes.

Associated broken build:

https://ge.spring.io/s/epphj7vruwcn6/tests/:spring-context:test/org.springframework.scheduling.support.CronTriggerTests/testDaylightSavingMissingHour(LocalDateTime,%20TimeZone)%5B2%5D?expanded-stacktrace=WyIwIl0
2021-04-20 12:18:01 +02:00
Sam Brannen e489706f13 Ensure @DateTimeFormat tests pass on Java 9+
Prior to this commit, two tests for exception handling regarding
@DateTimeFormat processing only passed on Java 8. This is due to the
fact that the toString() implementation for annotations changed in Java
9. Specifically, the representation for arrays changed from [] to {},
and strings are enclosed in double quotes beginning with Java 9.

This commit ensures that the affected @DateTimeFormat tests pass on
Java 9+, by making the assertions more lenient regarding toString()
output for annotations.

See gh-26777
See gh-26804
2021-04-18 15:48:00 +02:00
Sam Brannen 0f31830ae2 Retain root cause for parsing patterns in @DateTimeFormat
The support for fallback parsing patterns in @DateTimeFormat introduced
in gh-20292 introduced a regression in that the original cause of the
parsing exception was no longer retained.

gh-26777 addressed that regression for `java.time` support; whereas,
this commit addresses that regression for legacy Date types.

This commit ensures that the original ParseException is set as the
cause for any newly created ParseException, thereby retaining the
original exception as the root cause.

Closes gh-26804
2021-04-16 19:14:41 +02:00
Sam Brannen 22d9012081 Retain root cause for parsing patterns in @DateTimeFormat
The support for fallback parsing patterns in @DateTimeFormat introduced
in gh-20292 introduced a regression in that the original cause of the
parsing exception was no longer retained.

This commit ensures that the original DateTimeParseException is set as
the cause for any newly created DateTimeParseException, thereby
retaining the original exception as the root cause.

Closes gh-26777
2021-04-12 19:55:43 +02:00
Arjen Poutsma f982fd99d7 Fix timezone offset in CronExpressionTests
Closes gh-26744
2021-03-30 16:37:26 +02:00
Arjen Poutsma ab18ab6025 Fix CronExpression issue with ZonedDateTime & DST
This commit fixes an issue with CronExpression when used in combination
with ZonedDateTime and daylight saving time.

Closes gh-26744
2021-03-30 15:20:59 +02:00
Sam Brannen b2bcb0f93a Support multiple parsing patterns in @DateTimeFormat
Prior to this commit, @DateTimeFormat only supported a single format
for parsing date time values via the style, iso, and pattern attributes.

This commit introduces a new fallbackPatterns attribute that can be
used to configure multiple fallback patterns for parsing date time
values. This allows applications to accept multiple input formats for
date time values.

For example, if you wish to use the ISO date format for parsing and
printing but allow for lenient parsing of user input for various
additional date formats, you could annotate a field or method parameter
with configuration similar to the following.

    @DateTimeFormat(
        iso = ISO.DATE,
        fallbackPatterns = { "M/d/yy", "dd.MM.yyyy" }
    )

Closes gh-20292
2021-03-11 11:30:30 +01:00
Juergen Hoeller 3c9bd3177e Move getListenerId method to Smart/GenericApplicationListener
See gh-26638
2021-03-09 12:30:52 +01:00
Stephane Nicoll d308985edc Polish "Update reference to deprecated CronSequenceGenerator"
See gh-26651
2021-03-09 08:14:22 +01:00
Michel ten Voorde 5aef87f120 Update reference to deprecated CronSequenceGenerator
See gh-26651
2021-03-09 08:10:52 +01:00
Juergen Hoeller 48688b7b04 Pass getListenerId call on to delegate
See gh-26638
2021-03-08 23:45:47 +01:00
Juergen Hoeller 86902d27b2 Expose id/getListenerId in base EventListener/ApplicationListener (pulled up from tx)
Includes removeApplicationListeners(Predicate) method in ApplicationEventMulticaster.

Closes gh-26638
2021-03-08 19:31:56 +01:00
Arjen Poutsma eb68e6a62a Support SUN as minimum of range in CronExpression
This commit makes sure that SUN can be used at the beginning of a range,
 like SUN-FRI.

Closes gh-26598
2021-02-25 10:50:34 +01:00
Sam Brannen 262b7d7c27 Polishing 2021-02-24 17:14:10 +01:00
Sam Brannen 31d9f31806 Polish Javadoc for @DateTimeFormat 2021-02-24 11:38:07 +01:00
Brian Clozel 77a658f51b Fix registration of ApplicationStartupAware
Closes gh-26576
2021-02-23 11:45:53 +01:00
Sam Brannen db5be44ff4 Polishing 2021-02-22 17:02:17 +01:00
Sam Brannen 313e754a84 Support load-time weaving for @Component classes again
Since Spring Framework 5.2, the LoadTimeWeaver no longer weaves bean
classes annotated with @Component. This is a regression caused by the
changes in 40c62139ae, stemming from the fact that any class annotated
or meta-annotated with @Component is considered to be a candidate
configuration class in 'configuration lite' mode (i.e., a class without
the @Configuration annotation and without any @Bean methods) and
therefore now has its class eagerly loaded. This results in the class
being loaded before the LoadTimeWeaver has a chance to weave it.

This commit fixes this regression by explicitly avoiding eager class
loading for any 'lite' @Configuration or @Component class without @Bean
methods.

Closes gh-26199
2021-02-22 09:59:22 +01:00
Sam Brannen 207ee9e307 Polishing 2021-02-21 19:14:05 +01:00
Sam Brannen fd49c8f598 Polishing 2021-02-16 16:54:49 +01:00
Sébastien Deleuze 3524401bf1 Introduce a NativeDetector utility class
With the introduction of the -H:+InlineBeforeAnalysis native image
compiler flag in GraalVM 21.0.0, it is now possible to use an utility method and get code
removal at build time.

This flag will be enabled as of Spring Native 0.9.0.

closes gh-25795
2021-02-15 16:36:23 +01:00
Juergen Hoeller 3baa44c5ef Polishing 2021-02-14 18:53:53 +01:00
Juergen Hoeller df977a2fd2 Nullability refinements and related polishing 2021-02-14 17:57:32 +01:00
Juergen Hoeller defc2466b0 Fail early FactoryBean instantiation for LinkageError
Closes gh-26425
2021-02-14 17:56:38 +01:00
fengyuanwei a991c23db5 Close mapping streams after the ValidatorFactory has been built 2021-02-14 17:29:08 +01:00
Sam Brannen 03f1b65084 Polish Javadoc for ResourceLoader APIs 2021-01-26 12:20:28 +01:00
Sam Brannen 9d8910d869 Improve inline documentation for PostProcessorRegistrationDelegate
This commit introduces warnings in invokeBeanFactoryPostProcessors()
and registerBeanPostProcessors() to deter people from submitting PRs
that result in breaking changes.

Closes gh-26401
2021-01-22 13:34:29 +01:00
Stephane Nicoll 4779323d33 Clarify behaviour of condition attribute of CachePut
Closes gh-26186
2021-01-19 15:14:26 +01:00
Arjen Poutsma 67112b211a Rollback to midnight in quartz expressions
This commit makes sure that the CronExpression rolls back the time to
midnight when dealing with Quartz expression fields (such as "L", "LW",
etc.).

Closes gh-26390
2021-01-19 15:06:40 +01:00
Juergen Hoeller 799885fd6d Introduce public defineClass variant for SmartClassLoader implementations
Closes gh-26403
2021-01-19 12:03:18 +01:00
Juergen Hoeller 4ac27e4dab Suppress ClassCastException for payload type mismatch as well
Closes gh-26349
2021-01-11 09:44:38 +01:00
Arjen Poutsma d387d9ae1e Allow quartz expression in cron expression lists
This commit introduces support for lists of quartz cron fields, such
as "1L, LW" or "TUE#1, TUE#3, TUE#5".

Closes gh-26289
2021-01-07 14:27:07 +01:00
Arjen Poutsma 4f6d26b25c Parse list with range delta in CronExpression
Closes gh-26313
2021-01-04 16:02:28 +01:00
Sam Brannen 91a6254187 Test status quo for repeatable @PropertySource on composed annotation
This commit introduces tests that verify support for using
@PropertySource as a repeatable annotation without the
@PropertySources container, both locally on an @Configuration class
and on a custom composed annotation.

See gh-26329
2021-01-02 16:21:53 +01:00
Sam Brannen c8ad762b40 Polishing 2021-01-02 16:21:53 +01:00
Sam Brannen 5c1176786c Test status quo for list support in CronExpression
See gh-26289
2020-12-30 14:38:58 +01:00
Juergen Hoeller 00b56c026a Consistent handling of NullBean instances in resolveNamedBean
Closes gh-26271
2020-12-16 22:27:41 +01:00
Sébastien Deleuze e87e03c539 Refine ConfigurationClassPostProcessor behavior in native images
This commit refines ConfigurationClassPostProcessor behavior in
native images by skipping configuration classes enhancement
instead of raising an error.

See spring-projects-experimental/spring-graalvm-native#248 for
more details.

Closes gh-26236
2020-12-08 00:12:02 +01:00
Juergen Hoeller c970c318f4 Polishing 2020-12-07 22:08:01 +01:00
Brian Clozel 4337d8465c Remove spring.event.invoke-listener startup event
Prior to this commit, the `SimpleApplicationEventMulticaster` would be
instrumented with the `ApplicationStartup` and start/stop events for
invoking event listeners (`spring.event.invoke-listener`).

This feature was already limited to single-threaded event publishers,
but is still flawed since several types of events can happen
concurrently. Due to the single-threaded nature of the startup sequence,
our implementation should not produce startup events concurrently.

This can cause issues like gh-26057, where concurrent events lead to
inconcistencies when tracking parent/child relationships.

This commit removes the `spring.event.invoke-listener` startup event as
a result.

Fixes gh-26057
2020-12-03 15:40:31 +01:00
Johnny Lim c7f2f50c15
Polish ConfigurationClassPostProcessorTests
Closes gh-26197
2020-12-02 15:07:15 +01:00
Juergen Hoeller 56dbe06d9b Register @Bean definitions as dependent on containing configuration class
Closes gh-26167
2020-11-27 17:00:16 +01:00
Juergen Hoeller 86f9716fef Remove misleading default note on ISO.DATE_TIME
Closes gh-26134
2020-11-25 11:35:06 +01:00
Сергей Цыпанов e1f51b4bf8 Avoid multiple volatile reads/writes in a row where only one is enough 2020-11-05 12:25:24 +01:00
Juergen Hoeller 412aa06d86 Reliably refresh metadata for dynamically changing prototype bean class
Closes gh-26019
2020-11-04 16:48:54 +01:00
Juergen Hoeller d5b3e65718 Add since tag
See gh-26025
2020-11-04 16:46:44 +01:00
Erik van Paassen fbf8e37f94 Add FullyQualifiedAnnotationBeanNameGenerator.INSTANCE
Adds a static INSTANCE to FullyQualifiedAnnotationBeanNameGenerator,
just like its parent class, AnnotationBeanNameGenerator, does.

The class doesn't have any state and overriding/hiding the INSTANCE of
the superclass, this prevents unintended use of a regular
AnnotationBeanNameGenerator through
FullyQualifiedAnnotationBeanNameGenerator.INSTANCE.
2020-11-04 16:29:31 +01:00
Juergen Hoeller 95110d8257 Introduce TransactionalApplicationListener interface (with callback support)
Includes forPayload methods and common adapter classes for programmatic usage.
Aligns default order values for event handling delegates to LOWEST_PRECEDENCE.

Closes gh-24163
2020-10-22 15:19:32 +02:00
Сергей Цыпанов 8a04910bdd Drop explicit zeroing at instantiation of Atomic* objects 2020-10-06 15:45:12 +02:00
Juergen Hoeller 7116e5f755 Polishing 2020-09-25 20:40:54 +02:00
Sébastien Deleuze 2dbceb9053 Deprecate LiveBeansView
This commit deprecates LiveBeansView and related classes in order to allow
a future removal in order to increase the separation of concerns between
Spring Framework and Spring Boot, and the consistency between JVM
and native.

Closes gh-25820
2020-09-25 20:04:34 +02:00
Brian Clozel 61d893257e Rewrite "performance" test to JMH benchmarks
This commit rewrites the remaining "fastEnough" performance tests into
proper JMH benchmarks.

See gh-24830
2020-09-25 13:43:38 +02:00
Brian Clozel e02d3f32b4 Requalify tests as LONG_RUNNING
Prior to this commit, some tests would belong to the PERFORMANCE
`TestGroup`, while they were not testing for performance but rather
performing functional tests that involve long running operations or
timeouts.

This commit moves those tests to the LONG_RUNNING `TestGroup`.

See gh-24830
2020-09-25 13:43:38 +02:00
Juergen Hoeller 6c631e3d5c Merge branch '5.2.x'
# Conflicts:
#	spring-messaging/src/main/java/org/springframework/messaging/converter/MappingJackson2MessageConverter.java
2020-09-25 11:36:18 +02:00
Juergen Hoeller c83f6adc24 Revise event multicaster locking for non-synchronized retriever caching
Closes gh-25799
2020-09-25 11:24:26 +02:00
Sam Brannen d7fab85f51 Merge branch '5.2.x' 2020-09-25 11:17:24 +02:00
Sam Brannen f5d36aa47a Revert use of Map::computeIfAbsent in thread and tx scopes
Issues gh-25038 and gh-25618 collectively introduced a regression for
thread-scoped and transaction-scoped beans.

For example, given a thread-scoped bean X that depends on another
thread-scoped bean Y, if the names of the beans (when used as map keys)
end up in the same bucket within a ConcurrentHashMap AND an attempt is
made to retrieve bean X from the ApplicationContext prior to retrieving
bean Y, then the use of Map::computeIfAbsent in SimpleThreadScope
results in recursive access to the same internal bucket in the map.

On Java 8, that scenario simply hangs. On Java 9 and higher,
ConcurrentHashMap throws an IllegalStateException pointing out that a
"Recursive update" was attempted.

In light of these findings, we are reverting the changes made to
SimpleThreadScope and SimpleTransactionScope in commits 50a4fdac6e and
148dc95eb1.

Closes gh-25801
2020-09-25 11:00:06 +02:00
Juergen Hoeller bbe74635eb Merge branch '5.2.x' 2020-09-18 18:16:33 +02:00
Juergen Hoeller c1617d3c52 Polishing 2020-09-18 18:15:36 +02:00
Juergen Hoeller 051de3f179 Configurable java.time.Clock on TaskScheduler implementations
Closes gh-25782
2020-09-18 10:21:48 +02:00
Juergen Hoeller e4a3d5bf66 Deprecation wording with suggested alternative and without removal hint
See gh-25733
See gh-25736
2020-09-15 13:22:34 +02:00
Brian Clozel 078543ce67 Deprecate Joda time support
This commit deprecates the Joda time support and schedules it for
removal in 6.0.

Closes gh-25736
2020-09-08 14:46:48 +02:00
Arjen Poutsma 91b609817e Do not use BitSet in BitsCronField
This commit changes BitsCronField to use a long instead of a BitSet,
since the later can use significant memory.

Closes gh-25687
2020-09-08 10:11:32 +02:00
Juergen Hoeller 3cc0db5fc3 Merge branch '5.2.x'
# Conflicts:
#	build.gradle
2020-09-07 19:27:25 +02:00
Juergen Hoeller 4b211fb18c Javadoc refinements 2020-09-07 19:20:26 +02:00
Juergen Hoeller 75f394ca85 Merge branch '5.2.x' 2020-09-07 17:54:51 +02:00
Juergen Hoeller 613b05d814 Properties loading with ignoreResourceNotFound covers SocketException as well
Closes gh-25717
2020-09-07 17:51:14 +02:00
Brian Clozel c5694506ae Early configuration of ApplicationStartup on BeanFactory
Prior to this commit, the `GenericApplicationContext` configured the
`AppliationStartup` on the `BeanFactory` only right before refreshing it.
Delaying this has no purpose and we should instead configure it as soon
as possible by overriding the setter method.

Closes gh-25718
2020-09-07 10:48:59 +02:00
Yanming Zhou a2bb59f1b8 Replace StringBuffer with StringBuilder where possible 2020-09-03 22:40:51 +02:00
Stephane Nicoll a06deac5db Merge branch '5.2.x' 2020-09-02 11:29:25 +02:00
Stephane Nicoll cdfdc340d2 Log cache hit and cache miss for synchronized access
Closes gh-25248
2020-09-02 11:29:03 +02:00
Juergen Hoeller 689adb4bd0 Merge branch '5.2.x'
# Conflicts:
#	build.gradle
2020-09-01 23:46:11 +02:00
Juergen Hoeller 141470ff58 Explicit nullability declarations for getTarget() implementations 2020-09-01 23:26:22 +02:00
Сергей Цыпанов 1f3e52d932 gh-25650 Replace remaining usage of LinkedList with ArrayList in tests 2020-08-31 14:33:14 +02:00
Juergen Hoeller 00c5dbf11a Merge branch '5.2.x'
# Conflicts:
#	spring-beans/src/main/java/org/springframework/beans/CachedIntrospectionResults.java
2020-08-28 20:01:17 +02:00
Juergen Hoeller 6d9d4157ef Specifically detect Joda-Time 2.x
Closes gh-25655
2020-08-28 19:57:51 +02:00
Juergen Hoeller 2080878d82 Merge branch '5.2.x'
# Conflicts:
#	spring-beans/src/main/java/org/springframework/beans/factory/parsing/ParseState.java
2020-08-27 14:40:54 +02:00
Juergen Hoeller cf2e0c7959 Selected use of ArrayList instead of LinkedList in common places
See gh-25652
2020-08-27 14:14:44 +02:00
Juergen Hoeller 60fa704f78 Consistent behavior for overloaded @Bean methods with ASM processing
Closes gh-25263
2020-08-27 14:13:33 +02:00
Juergen Hoeller 874574513c Replace remaining usage of LinkedList with ArrayList/ArrayDeque
Closes gh-25650
2020-08-26 18:32:08 +02:00
Juergen Hoeller ff11467a0c Avoid resizing of fixed-size HashMap/LinkedHashMap variants
Closes gh-25349
2020-08-25 19:26:18 +02:00
Juergen Hoeller 7324140d20 Merge branch '5.2.x' 2020-08-25 16:21:00 +02:00
Juergen Hoeller 6f0461c569 Polishing 2020-08-25 16:17:22 +02:00
Juergen Hoeller 04df9b8f49 Efficient checks for empty strings and single character matches
Closes gh-25552
Closes gh-25553
2020-08-25 16:17:12 +02:00
Juergen Hoeller 0d4040aa63 Avoid potential integer overflow in seconds->millis transformation
Closes gh-25613
2020-08-25 16:16:34 +02:00
Sam Brannen 0f7ad1b5bf Merge branch '5.2.x' 2020-08-22 23:50:28 +02:00
Sam Brannen 148dc95eb1 Fix regressions in SimpleThreadScope and SimpleTransactionScope
PR gh-25038 introduced regressions in SimpleThreadScope and
SimpleTransactionScope in Spring Framework 5.2.7. Specifically, if a
thread-scoped or transaction-scoped bean has a dependency on another
thread-scoped or transaction-scoped bean, respectively, a
ConcurrentModificationException will be thrown on Java 11 or higher.

The reason is that Java 11 introduced a check for concurrent
modification in java.util.HashMap's computeIfAbsent() implementation,
and such a modification can occur when a thread-scoped bean is being
created in order to satisfy a dependency of another thread-scoped bean
that is currently being created.

This commit fixes these regressions by switching from HashMap to
ConcurrentHashMap for the instance maps in SimpleThreadScope and
SimpleTransactionScope.

Closes gh-25618
2020-08-22 23:19:58 +02:00
Sam Brannen 1891f8af70 Merge branch '5.2.x' 2020-08-16 20:04:24 +02:00
Sam Brannen 93e5214d01 Revise Javadoc regarding log level for non-static BFPP @Bean method
Closes gh-25590
2020-08-16 20:03:46 +02:00
Sam Brannen c558391e2c Declare interfaces as @FunctionalInterface where feasible
This commit declares each of the following public interfaces as a
@FunctionalInterface.

- org.springframework.context.ApplicationContextInitializer
- org.springframework.test.web.servlet.DispatcherServletCustomizer
- org.springframework.validation.MessageCodeFormatter
- org.springframework.util.IdGenerator
- org.springframework.beans.factory.config.YamlProcessor.MatchCallback
- org.springframework.beans.factory.config.YamlProcessor.DocumentMatcher

Closes gh-25580
2020-08-11 17:01:03 +02:00
Sam Brannen 1f35cc5cae Polish contribution
See gh-25506
2020-08-10 14:17:04 +02:00
Qimiao Chen af8ab2e3a8 Optimize DefaultLifecycleProcessor::startBeans
Closes gh-25506
2020-08-10 14:08:14 +02:00
Juergen Hoeller e87a49c61c Merge branch '5.2.x' 2020-08-07 21:43:33 +02:00
Juergen Hoeller 292f581cdd Populate dependencies metadata for resolved target behind lazy dependency proxy
Closes gh-25562
2020-08-07 21:42:02 +02:00
Juergen Hoeller f4c0ceb1cc Merge branch '5.2.x'
# Conflicts:
#	build.gradle
#	spring-tx/src/main/java/org/springframework/dao/support/PersistenceExceptionTranslationInterceptor.java
#	spring-web/src/main/java/org/springframework/web/bind/support/WebRequestDataBinder.java
#	spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerExecutionChain.java
#	spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMapping.java
2020-08-07 13:15:36 +02:00
Juergen Hoeller 8dd285f877 Polishing 2020-08-07 13:02:43 +02:00
Juergen Hoeller b345019415 Introduce getBeanProvider variants with allowEagerInit flag
Closes gh-25559
2020-08-07 12:07:13 +02:00
Stephane Nicoll 392f51cdd6 Merge branch '5.2.x' 2020-08-07 11:06:21 +02:00
Stephane Nicoll 6acbc5093a Indicate caches should be initialized in SimpleCacheManager
Closes gh-22988
2020-08-07 11:01:39 +02:00
Arjen Poutsma b0d273e047 Polishing 2020-08-05 11:26:25 +02:00
Arjen Poutsma 4d670ee25d Drop support for standalone "L" in CronExpression
This commit removes support for a standalone "L" in the
day-of-week of a cron expression, which used a locale-dependent
API to determine what the last day of the week is (Saturday or
Sunday ?).
Alternatively, we could have implement this in the exact way as Quartz
has done (i.e. treat the "L" like "SAT"), but we opted not to do that,
as having an explicit SAT or SUN is much clearer.
2020-08-05 09:42:18 +02:00
Arjen Poutsma 762cf0ffe8 Check for asterisk range in CronExpression
This commit makes sure that in CronExpression, the asterisk is only used
in a range field, and is not surrounded by unexpected characters.

Closes gh-19500
2020-08-04 16:34:02 +02:00
Arjen Poutsma 93b53dae29 Add support for Quartz features in CronExpression
This commit introduces support for Quartz-specific features in
CronExpression. This includes support for "L", "W", and "#".

Closes gh-20106
Closes gh-22436
2020-08-04 08:41:18 +02:00
Arjen Poutsma 1a8906bdc3 Support macros in CronExpression
This commit introduces supports for macros like "@yearly", "@monthly",
etc. in CronExpression.

Closes gh-25471
2020-08-04 07:51:32 +02:00
Arjen Poutsma dbec16d566 Add test for Friday 13th crontab failure
Added test for Friday 13th trigger, i.e. an uncommon crontab expression.
With the new CronExpression in place, this failure does not occur
anymore.

Closes gh-21574
2020-08-03 16:55:55 +02:00
Arjen Poutsma 72895f0810 Add test for combination of fixed date fields
Added test for a fixed day-of-week and day-of-month combination.
With the new CronExpression in place, this failure does not occur
anymore.

Closes gh-13621
2020-08-03 16:49:21 +02:00
Arjen Poutsma 87c3bb5797 Introduce CronExpression
This commit introduces CronExpression, a new for representing cron
expressions, and a direct replacement for CronSequenceGenerator.
2020-08-03 16:37:31 +02:00
Brian Clozel be801fc5fc Polish
See gh-24878
2020-07-28 14:48:25 +02:00
Juergen Hoeller a1a9bb3e7f Explicit note on phasing out serialization-based remoting
See gh-25379
2020-07-28 11:28:34 +02:00
Juergen Hoeller adce6593af Move metrics package to org.springframework.core
See gh-24878
2020-07-28 11:28:10 +02:00
Juergen Hoeller 9f211de113 Turn MethodArgumentNotValidException into subclass of BindException
Closes gh-23107
2020-07-28 11:08:04 +02:00
Brian Clozel 9301d7a294 Add application startup metrics support
This commit adds a new `StartupStep` interface and its factory
`ApplicationStartup`. Such steps are created, tagged with metadata and
thir execution time can be recorded - in order to collect metrics about
the application startup.

The default implementation is a "no-op" variant and has no side-effect.
Other implementations can record and collect events in a dedicated
metrics system or profiling tools. We provide here an implementation for
recording and storing steps with Java Flight Recorder.

This commit also instruments the Spring application context to gather
metrics about various phases of the application context, such as:

* context refresh phase
* bean definition registry post-processing
* bean factory post-processing
* beans instantiation and post-processing

Third part libraries involved in the Spring application context can
reuse the same infrastructure to record similar metrics.

Closes gh-24878
2020-07-27 22:37:14 +02:00
Sébastien Deleuze 05683fed7a Skip LoadTimeWeaverAwareProcessor with native images 2020-07-23 12:13:20 +02:00
Juergen Hoeller 718d46adac Check for alias overriding bean definition of same name
Closes gh-25430
2020-07-22 18:42:53 +02:00
Sam Brannen 335c3d5db6 Polish contribution
See gh-25445
2020-07-22 17:26:59 +02:00
XenoAmess ab859fcc96 Refine use of substring operations
Closes gh-25445
2020-07-22 17:26:42 +02:00
Sam Brannen a8901e3cf8 Polish contribution
See gh-25445
2020-07-22 16:36:14 +02:00
XenoAmess edfc6c0293 Refine use of substring operations
Closes gh-25445
2020-07-22 16:28:58 +02:00
XenoAmess c547809e89 Use instanceof instead of Class#isInstance where feasible
Closes gh-25446
2020-07-22 14:06:29 +02:00
Sam Brannen ae5913f3b6 Polish tests
See gh-25456
2020-07-22 11:09:52 +02:00
XenoAmess cd12583e13
Use Integer.parseInt instead of Integer.valueOf for primitive int
Closes gh-25456
2020-07-22 10:54:32 +02:00
XenoAmess 3b12beb1b8
Simplify if-statements with instanceof checks
Closes gh-25449
2020-07-22 10:34:27 +02:00
XenoAmess c7f44ff671
Fix links in Javadoc
Closes gh-25448
2020-07-22 10:24:55 +02:00
Juergen Hoeller e4e54b3c4a Merge branch '5.2.x' 2020-07-19 20:01:21 +02:00
Juergen Hoeller 7b6924522a Avoid unnecessarily alarming stack trace logged during scheduler resolution
Closes gh-23268
2020-07-19 19:55:19 +02:00
Juergen Hoeller 198d64d539 Merge branch '5.2.x'
# Conflicts:
#	build.gradle
2020-07-17 17:52:08 +02:00
Juergen Hoeller e9898f7d52 Polishing 2020-07-17 17:48:33 +02:00
Sam Brannen abe16eeb6e Use test name as thread name prefix in scheduling TaskExecutor tests
This commit also deletes a duplicate copy of the assertThreadNamePrefix()
method.
2020-07-11 17:01:54 +02:00
Sam Brannen 54d9dfa84f Merge branch '5.2.x' 2020-07-10 15:40:43 +02:00
Sam Brannen b769b73960 Improve JavaDoc for ConfigurableApplicationContext.refresh()
Closes gh-25380
2020-07-10 15:39:45 +02:00
Brian Clozel d9ccd618ea Deprecate remoting technologies support
Because of security and broader industry support, support for several
remoting technologies is now deprecated and scheduled for removal in
Spring Framework 6.0.

This commit deprecates the following remoting technologies:

* HTTPInvoker
* RMI
* Hessian
* JMS remoting

Other remoting technologies like EJB or JAXWS might be deprecated in the
future depending on industry support.

Closes gh-25379
2020-07-10 12:04:24 +02:00
Sébastien Deleuze 9d37794ebc Avoid using LiveBeansView in GraalVM native images
Closes gh-25344
2020-06-30 15:52:50 +02:00
Sébastien Deleuze 671d4519b2 Fix checkstyle error 2020-06-30 07:58:05 +02:00
Sébastien Deleuze 02b539c5f5 Leverage spring.ignore.xml flag to avoid XmlBeanDefinitionReader
Closes gh-25338
2020-06-30 07:38:30 +02:00
Juergen Hoeller 56c661829b Avoid package cycle through dedicated ResourcePropertiesPersister
See gh-25151
2020-06-23 16:54:55 +02:00
Sam Brannen ab0e651547 Polish SerializationTestUtils, clean up warnings, etc. 2020-06-20 18:17:03 +02:00
Sébastien Deleuze 63dff520e6 Disable and remove unsupported features from native images
This commit removes load time weaving, CGLIB and Objenesis support
from native images.

GraalDetector has been removed for now because of
https://github.com/oracle/graal/issues/2594. It should be reintroduced
when this bug will be fixed with NativeImageDetector class name.

Closes gh-25179
2020-06-20 17:05:13 +02:00
Sébastien Deleuze 1c75f95be0 Provide a flag to disable SpEL support
This commit introduces a spring.spel.ignore system property
which when set to true avoid initializing SpEL infrastructure.

A typical use case is optimizing GraalVM native image footprint
for applications not using SpEL. In order to be effective, those
classes should be initialized at build time:

- org.springframework.context.support.AbstractApplicationContext
- org.springframework.core.SpringProperties
- org.springframework.context.event.EventListenerMethodProcessor

Closes gh-25153
2020-06-18 17:08:15 +02:00
Sam Brannen edf25ce98a Polish ResourceBundleMessageSourceTests
- suppress warnings
- make tests faster (by sleeping less)
2020-06-18 11:49:44 +02:00
陈其苗 d60c55c296 Use computeIfAbsent in ResourceBundleMessageSource
Closes gh-25072
2020-06-18 11:07:24 +02:00
Сергей Цыпанов 7949937655 Remove redundant assignment of default values to volatile fields 2020-06-17 10:50:51 +02:00
Sam Brannen 8099fc8178 Use try-with-resources language construct where feasible
Closes gh-2063

Co-authored-by: igor-suhorukov <igor.suhorukov@gmail.com>
2020-06-16 22:57:45 +02:00
Juergen Hoeller 1279b3b822 Merge branch '5.2.x'
# Conflicts:
#	spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java
#	spring-context-support/src/main/java/org/springframework/cache/jcache/config/AbstractJCacheConfiguration.java
2020-06-11 23:53:27 +02:00
Juergen Hoeller e46ccd74b1 Consistent abstract declaration of "Abstract" base classes
Closes gh-25240
2020-06-11 23:43:41 +02:00
Juergen Hoeller 663f2e8afd Merge branch '5.2.x' 2020-06-10 22:53:06 +02:00
Juergen Hoeller ae1ed9d458 Document exception handling limitations in TaskDecorator implementations
Closes gh-25231
2020-06-10 22:52:01 +02:00
Sam Brannen 905483be30 Polish Javadoc for @PropertySource 2020-06-09 16:39:58 +02:00
Juergen Hoeller 5051d7302d Merge branch '5.2.x'
# Conflicts:
#	build.gradle
#	spring-test/src/main/java/org/springframework/mock/http/server/reactive/MockServerHttpRequest.java
#	spring-web/src/main/java/org/springframework/http/HttpHeaders.java
#	spring-web/src/testFixtures/java/org/springframework/web/testfixture/http/server/reactive/MockServerHttpRequest.java
2020-06-06 15:27:15 +02:00
Juergen Hoeller 196bb6fe32 Support for shared GroovyClassLoader in GroovyScriptFactory
Exposes setClassLoader method in ConfigurableApplicationContext interface as obvious first-class configuration option.

Closes gh-25177
2020-06-06 13:21:20 +02:00
Sam Brannen 0f0b1ffe0d Use computeIfAbsent in ScriptFactoryPostProcessor 2020-06-02 18:23:15 +02:00
Yoo In Keun 2549674f41 Refactor method name dispatching to switch statements
This commit refactors method name dispatching to switch statements in
WebSphereClassPreDefinePlugin.

Closes gh-25170
2020-06-02 17:29:55 +02:00
Juergen Hoeller 7207f7645c Deprecate InstantiationAwareBeanPostProcessorAdapter
Consistently relying on default methods in the corresponding interfaces.

Closes gh-25165
2020-05-29 23:07:10 +02:00
Juergen Hoeller 42ff01b5aa Merge branch '5.2.x' 2020-05-29 15:57:32 +02:00
Juergen Hoeller 2ff22510d9 Avoid earlyApplicationEvents iteration in case of empty Set
Closes gh-25161
2020-05-29 15:50:10 +02:00
Sam Brannen 763f7b9be8 Make TaskExecutor and TaskScheduler tests more robust 2020-05-27 15:25:39 +02:00
Sam Brannen c4ef002392 Stop to writing to STD_OUT in tests 2020-05-27 15:21:17 +02:00
Juergen Hoeller 399453d9f1 Merge branch '5.2.x'
# Conflicts:
#	spring-jdbc/src/test/java/org/springframework/jdbc/core/JdbcTemplateQueryTests.java
#	spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/NamedParameterJdbcTemplateTests.java
2020-05-22 17:16:09 +02:00
Juergen Hoeller d7161f5e5e Polishing 2020-05-22 16:23:46 +02:00
Juergen Hoeller e5c079edfc Introduce serializeToByteArray/deserializeFromByteArray on (De)Serializer
Closes gh-25117
2020-05-22 16:22:59 +02:00
Juergen Hoeller 807ded24c4 Avoid ClassCastException on IllegalArgumentException from sync invocation
Closes gh-25110
2020-05-22 16:12:49 +02:00
Juergen Hoeller 9999414b3b Merge branch '5.2.x' 2020-05-18 14:24:33 +02:00
Juergen Hoeller 06cfd80c1c Avoid full synchronization in refreshable getBeanFactory() implementation
Closes gh-25081
2020-05-18 14:22:24 +02:00
Juergen Hoeller 28177ad91b Explicit notes on access to standard context beans in SpEL expressions
Closes gh-25037
2020-05-18 14:19:05 +02:00
Сергей Цыпанов 703d54677e Avoid unnecessary boxing/unboxing of primitives
Closes gh-25080
2020-05-15 18:01:59 +02:00
Rossen Stoyanchev 6403a9f10e Defer decision on BindingResult type until access
Closes gh-24347
2020-05-14 15:42:43 +01:00
Juergen Hoeller 26c205589b Merge branch '5.2.x'
# Conflicts:
#	build.gradle
#	spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java
#	spring-context/src/main/java/org/springframework/validation/beanvalidation/MethodValidationInterceptor.java
2020-05-14 00:33:37 +02:00
Juergen Hoeller fe33822fa7 Polishing 2020-05-14 00:23:20 +02:00
Juergen Hoeller 3c1ee64b7f Explicit nullability declarations for all AOP Alliance methods
Includes consistent declarations in AOP Alliance related Spring AOP code.

Closes gh-24117
2020-05-13 23:33:47 +02:00
Juergen Hoeller a3c5625d4e Internal cache of pre-filtered BeanPostProcessors (for faster iteration)
Also includes bulk addition in PostProcessorRegistrationDelegate.

Closes gh-24681
Closes gh-24756
2020-05-13 15:53:48 +02:00
Juergen Hoeller f09093132e Use proxyBeanMethods=false on remaining internal configuration classes
Closes gh-24511
2020-05-12 22:19:44 +02:00
Sam Brannen 273d952ddf Merge branch '5.2.x' 2020-05-12 18:49:48 +02:00
Andy Wilkinson 1015f79b42 Include timeout unit in shutdown failure logging
Closes gh-25058
2020-05-12 18:42:40 +02:00
Qimiao Chen 311b333814
Use computeIfAbsent in ResourceBundleMessageSource
This commit optimizes code in ResourceBundleMessageSource
by using computeIfAbsent instead of putIfAbsent.

In addition, the content of some Javadoc has been adjusted.

Closes gh-25054
2020-05-12 14:55:58 +02:00
liym d54b903d28
Fix typo in RmiSupportTests
Closes gh-25051
2020-05-12 14:19:16 +02:00
Sam Brannen b313b3395f Fix AutoProxyLazyInitTests
See gh-24915
2020-05-12 12:37:10 +02:00
Sam Brannen 3c3e8e6a8b Only proxy supported beans in BeanNameAutoProxyCreator
Prior to this commit, if a BeanNameAutoProxyCreator was configured with
a custom TargetSourceCreator, the TargetSourceCreator was applied to
all beans in the ApplicationContext. Thus, the list of supported
beanNames was effectively ignored when applying any
TargetSourceCreator. Consequently, if a TargetSourceCreator returned a
non-null TargetSource for a given bean, the BeanNameAutoProxyCreator
proxied the bean even if the bean name had not been configured in the
beanNames list.

This commit addresses this issue by ensuring that a custom
TargetSourceCreator is only applied to beans whose names match the
configured beanNames list in a BeanNameAutoProxyCreator.

Closes gh-24915
2020-05-12 11:59:51 +02:00
Sam Brannen a07dc80d72 Polishing 2020-05-12 11:15:14 +02:00
Sam Brannen 3f30dcae80 Merge branch '5.2.x' 2020-05-10 15:44:57 +02:00
Yanming Zhou 50a4fdac6e
Use Map::computeIfAbsent to simplify scope implementations
Closes gh-25038
2020-05-10 15:41:00 +02:00
Sam Brannen 12e05280ad Upgrade to AssertJ 3.16 2020-05-06 15:22:23 +02:00
Sam Brannen c3f439417e Disable remaining JavaScript-based tests on Java 15+
This commit disables all remaining JavaScript-based tests on Java 15 or
higher since the Nashorn JavaScript engine is no longer part of the JDK.
2020-04-28 17:22:22 +02:00
Sam Brannen 71ed8143a1 Disable StandardScriptFactoryTests on Java 15+
This commit disables StandardScriptFactoryTests on Java 15 or higher
since the Nashorn JavaScript engine is no longer part of the JDK.
2020-04-28 16:56:15 +02:00
Juergen Hoeller 57f1e86a35 AnnotationBeanNameGenerator caches meta-annotations for stereotype check
Closes gh-24980
2020-04-27 13:47:58 +02:00
Juergen Hoeller 73fadd8b7c Polishing 2020-04-27 11:45:41 +02:00
Juergen Hoeller 127e879726 Store source in index-derived ScannedGenericBeanDefinition as well
Includes consistent constructor-level storage of derived resource in ScannedGenericBeanDefinition and ConfigurationClassBeanDefinition.

Closes gh-24978
2020-04-27 11:45:08 +02:00
Sam Brannen 9628038c58 Upgrade to BeanShell 2.0b6 2020-04-07 18:06:43 +02:00
Juergen Hoeller 8595f01e44 Polishing 2020-04-03 21:08:45 +02:00
陈其苗 13970ae528 Use autoboxing instead of explicit wrapping in tests
Closes gh-24801
2020-04-01 14:34:20 +02:00
Sam Brannen 01cf0a3d4e Polish MBeanClientInterceptorTests and recover two lost tests
Two test methods were missing the @Test annotation after the migration
from JUnit 3 to JUnit 4.
2020-03-31 19:02:15 +02:00
Sam Brannen 9bd74c270f Remove flaky check in MBeanClientInterceptorTests
Prior to this commit, the testTestLazyConnectionToRemote() method in
MBeanClientInterceptorTests expected an exception to be thrown while
attempting to access the state of a proxied MBean after the MBeanServer
had been shutdown; however, the test occasionally failed if the server
had not been properly shutdown.

Since an attempt to wait on the server to shutdown proved not to be
consistently helpful in this scenario, we are entirely removing this
check from the test.
2020-03-31 18:55:54 +02:00
Sam Brannen e26764d249 Remove duplicate words in documentation and polish Javadoc 2020-03-31 12:17:58 +02:00
Сергей Цыпанов e63d1cf12d Improve usage of ByteArrayOutputStream/ByteArrayInputStream
Closes gh-24805
2020-03-30 13:22:21 +02:00
Qimiao Chen 7c831d2ef4
Replace anonymous inner classes with lambdas in tests
Closes gh-24808
2020-03-30 12:02:23 +02:00
Sam Brannen 06fa8692cd Attempt to make MBeanClientInterceptorTests more robust 2020-03-27 11:18:45 +01:00
Sam Brannen ac11acb532 Optimize sorting in PostProcessorRegistrationDelegate
Closes gh-24776
2020-03-26 17:32:38 +01:00
Sam Brannen 5c977ce119 Make remaining static fields final in CommonAnnotationBPP 2020-03-25 18:58:56 +01:00
Sam Brannen 6d0bab332c Polishing 2020-03-25 18:41:21 +01:00
Qimiao Chen c42a0eeb38
Make resourceAnnotationTypes field final in CommonAnnotationBPP
Closes gh-24774
2020-03-25 14:34:29 +01:00
Juergen Hoeller 910d2788e9 Polishing 2020-03-23 18:02:55 +01:00
Juergen Hoeller 2e23cf32ce Clarify name generation responsibility for PropertySourceFactory impls
Closes gh-24757
2020-03-23 18:02:05 +01:00
陈其苗 821a8eebdd Improve Javadoc in Configuration 2020-03-23 15:42:45 +01:00
Sam Brannen b069efade4 Polish Javadoc for @ManagedAttribute
See gh-24742
2020-03-23 11:34:25 +01:00
Rossen Stoyanchev 1f72ab4816 Add Javadoc to ManagedAttribute
Closes: gh-24742
2020-03-20 21:50:52 +00:00
Qimiao Chen 09b36380cd
Fix typos in source files
Closes gh-24746
2020-03-20 20:06:52 +01:00
Sam Brannen e6814f6609 Clean up warnings in Jsr354NumberFormatAnnotationFormatterFactory 2020-03-18 17:04:28 +01:00
Sam Brannen 678b6edad2 Delete unused method in ConfigurationClassParser 2020-03-18 17:01:33 +01:00
Qimiao Chen c8c1e61c0a
Improve Javadoc in AutoProxyRegistrar
Closes gh-24688

Co-authored-by: Sam Brannen <sbrannen@pivotal.io>
2020-03-13 10:01:58 +01:00
Juergen Hoeller bcee6b9da4 Consistent assertions for supplier-based bean definition tests 2020-03-11 14:55:39 +01:00
Juergen Hoeller bee63e38c1 Create ScannedGenericBeanDefinitions for index-derived components as well
Closes gh-24638
2020-03-11 14:54:16 +01:00
Juergen Hoeller 0e95282153 Polishing 2020-02-24 19:08:23 +01:00
Juergen Hoeller 2afe5802c0 Clarify setCacheMillis/setCacheSeconds vs java.util.ResourceBundle
Closes gh-24563
2020-02-24 19:08:13 +01:00
Hyunjin Choi ede2a1d4b2 Remove unnecessary semicolon in some enum classes 2020-02-24 14:56:12 +01:00
ZhangT 6add7b4dec
Polishing
Closes gh-24543
2020-02-17 17:33:39 +01:00
Juergen Hoeller a4179b4795 Polishing 2020-02-12 18:32:32 +01:00
Juergen Hoeller d1c7083e77 Consistent ROLE_INFRASTRUCTURE declarations for configuration classes
Closes gh-24509
2020-02-12 16:49:02 +01:00
Sam Brannen 9dbd411f81 Suppress warnings in Gradle build 2020-02-12 11:04:07 +01:00
Sam Brannen 974cacac31 Support nested annotations in ASM-based processing again
Spring Framework 5.0 introduced a regression in ASM-based annotation
processing. Specifically, nested annotations were no longer supported,
and component scanning resulted in an exception if a candidate
component was annotated with an annotation that contained nested
annotations.

This commit fixes this regression by introducing special handling in
AnnotationTypeMapping that supports extracting values from objects of
type TypeMappedAnnotation when necessary.

Closes gh-24375
2020-02-12 10:36:54 +01:00
Rossen Stoyanchev 0a974511bd Expose awaitTerminationMillis presion
Closes gh-24496
2020-02-11 14:02:50 +00:00
Juergen Hoeller b23049bd27 Polishing 2020-02-06 12:59:55 +01:00
Juergen Hoeller 82adb09490 ImportSelector.getExclusionFilter() naming and javadoc clarification
See gh-24175
2020-02-05 18:20:27 +01:00
Juergen Hoeller d93303c008 ImportSelector.getCandidateFilter() for transitive filtering of classes
Closes gh-24175
2020-02-05 12:35:16 +01:00
Qimiao Chen 5aa37ea07b
Let BFAwareGeneratorStrategy extend ClassLoaderAwareGeneratorStrategy
This commit updates BeanFactoryAwareGeneratorStrategy to extend 
ClassLoaderAwareGeneratorStrategy in order to avoid duplication of the
common generate() implementation.

Closes gh-24396
2020-02-04 14:10:59 +01:00
Sam Brannen 984f9de191 Fix Checkstyle violation
See gh-24375
2020-01-16 18:14:14 +01:00
Sam Brannen 2a2efbe611 Introduce @Disabled regression test for gh-24375 2020-01-16 17:16:57 +01:00
Sébastien Deleuze 3f1882c4eb Support noarg callable references in Kotlin beans DSL
Closes gh-23395
2020-01-13 10:53:23 +01:00
Stephane Nicoll bdb9f9570e Polish 2020-01-09 17:08:48 +01:00
Juergen Hoeller 4936a637fe Polishing 2020-01-09 17:03:17 +01:00
Juergen Hoeller b0e4b7e29c Re-calculate SimpleKey's hashCode field on deserialization
Closes gh-24320
2020-01-09 15:39:04 +01:00
stsypanov 8e5cad2af3 Add fast path for ClassUtils.hasMethod() 2020-01-08 18:52:15 +01:00
Sam Brannen e3e7d90415 Improve documentation for FullyQualifiedAnnotationBeanNameGenerator
See gh-24114
2020-01-08 16:47:39 +01:00
Sam Brannen b4c91e7dac Introduce BeanNameGenerator based on fully qualified class name
Prior to this commit, Spring offered two top-level implementations of
the BeanNameGenerator strategy: DefaultBeanNameGenerator and
AnnotationBeanNameGenerator. The latter is used as the default bean
name generator for beans picked up via component scanning. In a typical
application, this strategy works well; however, if multiple component
scanned beans have the same simple class name (i.e., identical names
ignoring the package), a BeanDefinitionStoreException is thrown.

To address such naming conflicts, users of Spring have had to implement
a custom BeanNameGenerator based on the fully qualified class name of
such components.

Similar conflicts can arise with components registered via
configuration class imports (i.e., via @Import), and
ConfigurationClassPostProcessor addresses this via an anonymous inner
class that extends AnnotationBeanNameGenerator but falls back to using
the fully qualified class name if an explicit bean name is not provided
via an annotation.

This commit extracts the implementation of
ConfigurationClassPostProcessor's internal BeanNameGenerator into a new
top-level FullyQualifiedAnnotationBeanNameGenerator class that can be
used to disambiguate between same-named components residing in
different packages that are picked up via component scanning. This bean
name generator can be configured via @ComponentScan's nameGenerator
attribute.

Closes gh-24114
2020-01-07 19:39:28 +01:00
Sam Brannen e1fb4a1966 Polishing 2020-01-07 18:47:54 +01:00
Sam Brannen 8a371c7669 Use Gradle test fixture support for spring-aop
See gh-23550
2020-01-02 16:01:35 +01:00
Sam Brannen 57b771ba92 Move common FactoryMethods to spring-beans test fixtures
See gh-23550
2020-01-02 16:01:35 +01:00
Sam Brannen 726b1bb1d0 Rename test fixture package in spring-context
See gh-23550
2020-01-02 16:01:35 +01:00
Sam Brannen 7cd4ddf5fc Rename test fixture package in spring-beans
See gh-23550
2020-01-02 16:01:35 +01:00
Sam Brannen 4260c34b47 Rename test fixture package in spring-core
See gh-23550
2020-01-02 16:01:34 +01:00
Sam Brannen 61d4ee594d Use Gradle test fixture support for spring-beans and spring-context
See gh-23550
2020-01-02 16:01:34 +01:00
Sam Brannen 5718bf424b Use Gradle test fixture support for spring-core
See gh-23550
2020-01-02 16:01:34 +01:00
Juergen Hoeller 7474ee7041 Polishing 2019-12-16 16:50:30 +01:00
Sam Brannen 47b18e5ea9 Polishing 2019-12-13 16:12:39 +01:00
lixiaolong11000 bee2b7cd73 Add missing test cases in XmlBeanFactoryTests
Closes gh-24189
2019-12-13 15:56:06 +01:00
Johnny Lim 1e83e889aa Use hasSize() where possible
See gh-24172
2019-12-10 07:58:53 +01:00
Sam Brannen 093323beeb Introduce Checkstyle rule to prohibit class names ending with "Test" 2019-11-29 17:30:29 +01:00
Sam Brannen 59e250c93c Consistent use of SCOPE_PROTOTYPE and SCOPE_SINGLETON constants
Closes gh-19905
2019-11-24 13:49:43 +01:00
Sébastien Deleuze 6c7250b0ae Make Kotlin DSL class constructors internal
Closes gh-24059
2019-11-22 16:10:42 +01:00
Sam Brannen fd6efb9a65 Polishing 2019-11-19 15:53:20 +01:00
Sam Brannen 8df3afd0b6 Polish contribution
See gh-23895
2019-11-14 13:26:38 +01:00
Sam Brannen 8186b77b58 Polish contribution
See gh-23895
2019-11-14 09:59:42 +01:00
monosoul a0e4ac39bf Inverse condition to fix ISO-formatted Instant parsing
Prior to this commit, InstantFormatter was able to properly serialize
an Instant that is far in the future (or in the past), but it could not
properly deserialize it, because in such scenarios an ISO-formatted
Instant starts with a +/- sign.

This commit fixes this issue, while maintaining the previous contract,
and also introduces tests for InstantFormatter.

Closes gh-23895
2019-11-14 09:59:42 +01:00
Juergen Hoeller 3dc5e7b1d5 Avoid String concatenation for lookup in StaticMessageSource
Closes gh-22451
2019-11-13 23:41:26 +01:00
Juergen Hoeller 22211a01ce Polishing 2019-11-13 17:23:23 +01:00
stsypanov f2b3953d76 Use array.clone() instead of manual array creation 2019-11-13 13:53:42 +01:00
Juergen Hoeller f61d728db9 Fallback Locale other than the system Locale through setDefaultLocale
Closes gh-23977
2019-11-13 13:48:08 +01:00
Juergen Hoeller c4ec6aea68 Fix Checkstyle violations
See gh-23784
2019-11-11 17:18:52 +01:00
Steven Schlansker fc55e66d50 ApplicationListenerMethodAdapter: gracefully handle beans which are actually NullBean
Currently, if you have an optional event listener (via a @Bean method returning `null`)
this causes the event multicaster to explode violently.  Now, we just safely skip it.
2019-11-11 15:43:29 +01:00
GungnirLaevatain d494621ee3 avoid store all bean name 2019-11-11 15:43:05 +01:00
Sam Brannen 64dfa462a6 Fix Javadoc for SmartLifecycle.DEFAULT_PHASE regarding ordering
Closes gh-23956
2019-11-09 18:03:07 +01:00
stsypanov f5ae3c77c6 Use Method::getParameterCount where possible 2019-11-07 18:00:15 +01:00
Sam Brannen d6002092c4 Clean up build warnings for ApplicationContextExpressionTests 2019-11-04 15:44:53 +01:00
Sam Brannen 74b7b550f6 Make MBeanServer tests more robust
This commit refactors several tests to use SocketUtils to find an
available port, compose a custom JMX service URL using that port, and
start an MBeanServer for the particular test using that port.

This commit also makes other changes to MBeanServer related tests in an
effort to make them more robust when executed concurrently.

Closes gh-23699
2019-10-31 14:34:57 +01:00
Sam Brannen 57b4b74e7d Polish Javadoc for JMX factory beans 2019-10-31 13:55:13 +01:00
Sam Brannen 9f00eb68e9 Clean up warnings 2019-10-30 19:14:58 +01:00
Christoph Dreis 3c17178b16 Fix Mockito deprecations 2019-10-30 18:30:05 +01:00
Brian Clozel 4beb25b318 Reorder date formatting converter in registrar
Prior to this commit, the `DateFormatterRegistrar` would register the
annotation-based formatter before the pattern-based formatter. This
would create an issue when an application tries to convert a `String` to
an annotated `@DateTimeFormat Date`: since the converters are considered
in reversed order of registration in
`GenericConversionServicei#ConvertersForPair`, the pattern-based variant
would always be considered before the annotation-based variant,
overriding the developer's opinion.

This commit aligns the `DateFormatterRegistrar` with the
`DateTimeFormatterRegistrar` and registers the annotation-based variant
last.

Closes gh-23893
2019-10-30 17:15:59 +01:00
Juergen Hoeller 19ff7d84ab Polishing 2019-10-30 14:31:46 +01:00
Sam Brannen 4dc966b04b Include @Inject TCK tests in the build again
Commit 979508a7f3 removed the JUnit 4
dependency from all modules except spring-test. Unfortunately, the
@Inject TCK tests (SpringAtInjectTckTests) are still based on JUnit 3.
Thus, that commit accidentally excluded those tests from the build.

This commit includes SpringAtInjectTckTests in the build again by
introducing a test runtime dependency on the JUnit Vintage TestEngine
in spring-context.

See gh-23451
2019-09-27 13:57:31 +02:00
Juergen Hoeller 2861fc65bd Polishing 2019-09-27 10:17:56 +02:00
Sam Brannen 6a207d0012 Polish AnnotationConfigApplicationContextTests 2019-09-26 16:45:49 +02:00
Johnny Lim 2a4dbcc623 Fix an assertion in AnnotationConfigApplicationContextTests
Closes gh-23719
2019-09-26 16:34:27 +02:00
Sam Brannen f05b4625de Merge branch '5.1.x' 2019-09-26 10:55:55 +02:00
Sam Brannen 7d126d3288 Improve documentation regarding "annotated classes"
See gh-23638
2019-09-26 10:26:36 +02:00
Juergen Hoeller 3616e96792 Upgrade to SLF4J 1.7.28, Groovy 2.5.8, RxJava 2.2.12, Joda-Time 2.10.4, Rome 1.12.2, OkHttp 3.14.3, Apache HttpClient 4.5.10, Apache Johnzon 1.1.13 2019-09-25 22:27:41 +02:00
Juergen Hoeller 1aa0ea0281 Fix nullability declarations on internal ParserStrategyUtils methods 2019-09-25 13:51:20 +02:00
Juergen Hoeller bd70f10d2b Merge branch '5.1.x'
# Conflicts:
#	build.gradle
#	spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java
#	spring-aspects/spring-aspects.gradle
#	spring-beans/src/main/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessor.java
#	spring-beans/src/main/java/org/springframework/beans/factory/support/GenericBeanDefinition.java
#	spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java
#	spring-orm/spring-orm.gradle
#	spring-test/spring-test.gradle
2019-09-25 12:43:24 +02:00
Juergen Hoeller 0519a2ff3c Exclude jdk package in ShadowingClassLoader (JDK 11 compatibility)
Closes gh-23641
2019-09-25 12:11:33 +02:00
Juergen Hoeller 6a08bfdff7 Avoid unnecessary synchronization for non-existent missing caches
Closes gh-23635
2019-09-25 12:10:23 +02:00
Sam Brannen b9013ada9f Abort MBeanServer tests if BindException encountered
This commit builds on the previous commit but covers exceptions thrown
by @BeforeEach and @AfterEach methods as well as @Test methods.
2019-09-24 19:20:39 +02:00
Sam Brannen 435cc67026 Abort MBeanServer tests if BindException encountered 2019-09-24 18:57:30 +02:00
Juergen Hoeller e68132686d Restore lenient target type handling for FactoryBean definitions
Closes gh-23561
2019-09-20 21:54:32 +02:00
Sam Brannen 3603e0c448 Set Spring-specific name for shutdown hook thread
Prior to this commit, the name of the Thread registered via
ConfigurableApplicationContext#registerShutdownHook() was the generic,
default thread name ("Thread-#"). That made it difficult to discern
which executing thread was the Spring ApplicationContext shutdown hook.

This commit improves diagnostics by setting the thread name of the
ApplicationContext shutdown hook to "SpringContextShutdownHook".

Closes gh-23670
2019-09-20 13:16:59 +02:00
Sam Brannen a676059699 Declare CRON_DISABLED constant value only once
This commit removes the duplicated CRON_DISABLED constant value from
@Scheuled and simply refers to the ScheduledTaskRegistrar.CRON_DISABLED
constant.

This avoids a potential package cycle by ensuring that the `annotation`
package depends on the `config` package but not the other way around.

See gh-23568
2019-09-16 15:17:58 +02:00
Phillip Webb d945ae9191 Add blank line between java and javax imports
See gh-23539

Co-authored-by: Sam Brannen <sbrannen@pivotal.io>
2019-09-16 13:41:59 +02:00
Phillip Webb 077754b8e0 Support constructor injection for @Import classes
Allow `ImportBeanDefinitionRegistrar`, `ImportSelector`,
`DeferredImportSelector.Group` and `TypeFilter` to use constructor
parameters as an alternative to `*Aware` callbacks.

In order to remain backwards compatible, injection only occurs
when there is a single constructor with one or more parameters.

The following parameter types are supported:

* `Environment`
* `BeanFactory`
* `ClassLoader`
* `ResourceLoader`

In order to keep the algorithm simple, subclass parameter types are
not supported. For example, you cannot use `ConfigurableEnvironment`
instead of `Environment`.

Closes gh-23637
2019-09-13 15:20:57 -07:00
Sam Brannen d689ef8891 Support disabling cron jobs registered via SchedulingConfigurer
Prior to this commit, support was provided for disabling cron jobs
configured with an explicit "-" cron expression. However, the "-"
expression was only supported when supplied via the @Scheduled
annotation.

This commit adds support for disabling cron jobs configured with the
"-" cron expression when a cron job is registered via the
addCronTask(Runnable, String) method in the ScheduledTaskRegistrar
supplied to a SchedulingConfigurer.

Closes gh-23568
2019-09-12 16:08:26 +02:00
Andy Wilkinson 508b6798ff Move jmx.log beneath build/ to avoid UP-TO-DATE pollution
Previously, some tests in spring-context wrote a file named jmx.log
into spring-context/. This led to the file being included in the
sources of the Checkstyle NoHTTP Gradle task, breaking that task's
UP-TO-DATE checks and causing it to execute unnecessarily.

This commit updates the tests to write the jmx.log file beneath
spring-context/build/ so that it is not included in the sources of the
Checkstyle NoHTTP task.

Closes gh-23623
2019-09-12 11:39:43 +02:00
Sam Brannen 30cff46e7f Prevent improper use of testing framework APIs
Prior to this commit, a lot of work had been done to prevent improper
use of testing Framework APIs throughout the codebase; however, there
were still some loopholes.

This commit addresses these loopholes by introducing additional
Checkstyle rules (and modifying existing rules) to prevent improper use
of testing framework APIs in production code as well as in test code.

- Checkstyle rules for banned imports have been refactored into
  multiple rules specific to JUnit 3, JUnit 4, JUnit Jupiter, and
  TestNG.
- Accidental usage of org.junit.Assume has been switched to
  org.junit.jupiter.api.Assumptions.
- All test classes now reside under org.springframework packages.
- All test classes (including abstract test classes) now conform to the
  `*Tests` naming convention.
  - As an added bonus, tests in the renamed
    ScenariosForSpringSecurityExpressionTests are now included in the
    build.
- Dead JUnit 4 parameterized code has been removed from
  DefaultServerWebExchangeCheckNotModifiedTests.

Closes gh-22962
2019-09-12 11:20:56 +02:00
Sam Brannen 591995ecc8 Polish and revive disabled tests
This commit revives some previously disabled tests and converts
some usage of @Disabled to @EnabledForTestGroups(...).
2019-09-06 15:57:27 +02:00
Phillip Webb deba2ed1b3 Add blank line between java and javax imports
See gh-23539
2019-09-04 22:05:46 -07:00
Juergen Hoeller 3bc27e8d14 Streamline AnnotationFilter usage with the MergedAnnotations API
MergedAnnotations provides 'from' variants with RepeatableContainers but without AnnotationFilter argument now, avoiding the need to refer to AnnotationFilter.PLAIN as a default at call sites.
2019-09-04 12:18:49 +02:00
Juergen Hoeller f26866e4d4 Introduce getType variant with allowFactoryBeanInit flag
Closes gh-23374
2019-09-04 00:06:23 +02:00
Brian Clozel d4089747b8 Use dependency management in Framework build
Prior to this commit, the Spring Framework build would partially use the
dependency management plugin to import and enforce BOMs.

This commit applies the dependency management plugin to all Java
projects and regroups all version management declaration in the root
`build.gradle` file (versions and exclusions).

Some versions are overridden in specific modules for
backwards-compatibility reasons or extended support.

This commit also adds the Gradle versions plugin that checks for
dependency upgrades in artifact repositories and produces a report; you
can use the following:

    ./gradlew dependencyUpdates
2019-09-02 18:01:09 +02:00
Sebastien Deleuze ca02cc1194 Migrate to AssertJ in Kotlin tests
Closes gh-23475
2019-09-02 15:59:26 +02:00
Sam Brannen c004ef888c Configure index in @ParameterizedTest display names
This commit prepends "[{index}] " to all custom display names
configured via @ParameterizedTest.

This provides better diagnostics between the "technical names" reported
on the CI server vs. the "display names" reported within a developer's
IDE.

See gh-23451
2019-08-28 17:06:23 +02:00
Sam Brannen ad6231ad29 Add missing @Override annotations 2019-08-23 13:50:58 +02:00
Sam Brannen a07ce8eb82 Polishing 2019-08-23 13:50:57 +02:00
Sam Brannen 3e2b977d5d Re-enable shadowed, overridden @Test and lifecycle methods
Due to a bug (or "unintentional feature") in JUnit 4, overridden test
and lifecycle methods not annotated with @Test, @Before, @After, etc.
are still executed as test methods and lifecycle methods; however,
JUnit Jupiter does not support that. Thus, prior to this commit, some
overridden test and lifecycle methods were no longer executed after the
migration from JUnit 4 to JUnit Jupiter.

This commit addresses this issue for such known use cases, but there
are likely other such use cases within Spring's test suite.

See gh-23451
2019-08-23 13:50:57 +02:00
Sam Brannen 742cb90d34 Delete obsolete abstract test classes 2019-08-23 13:49:35 +02:00
Brian Clozel e9523161f0 Revert "Revert "Refactor Gradle tasks in Spring Framework build""
This reverts commit fb0d618751.
2019-08-20 20:26:43 +02:00
Stephane Nicoll fb0d618751 Revert "Refactor Gradle tasks in Spring Framework build"
This reverts commit 1539ba8991.
2019-08-20 20:07:11 +02:00
Brian Clozel 1539ba8991 Refactor Gradle tasks in Spring Framework build
This commit reorganizes tasks and scripts in the build to only apply
them where they're needed. We're considering here 3 "types" of projects
in our build:
* the root project, handling documentation, publishing, etc
* framework modules (a project that's published as a spring artifact)
* internal modules, such as the BOM, our coroutines support and our
integration-tests

With this change, we're strealining the project configuration for all
spring modules and only applying plugins when needed (typically our
kotlin support).

See gh-23282
2019-08-20 18:17:02 +02:00
Sam Brannen 288461a541 Introduce @EnabledForTestGroups in Spring's test suite
Closes gh-23476
2019-08-17 14:47:24 +02:00
Sam Brannen 979508a7f3 Remove JUnit 4 dependency from all modules except spring-test
This commit removes the JUnit 4 dependency from all modules except
spring-test which provides explicit JUnit 4 support.

This commit also includes the following.

- migration from JUnit 4 assertions to JUnit Jupiter assertions in all
  Kotlin tests
- migration from JUnit 4 assumptions in Spring's TestGroup support to
  JUnit Jupiter assumptions, based on org.opentest4j.TestAbortedException
- introduction of a new TestGroups utility class than can be used from
  existing JUnit 4 tests in the spring-test module in order to perform
  assumptions using JUnit 4's Assume class

See gh-23451
2019-08-17 11:37:21 +02:00
Sam Brannen 3f3e41923f Migrate rest of test suite from JUnit 4 to JUnit Jupiter
This commit migrates the rest of Spring's test suite to JUnit Jupiter,
except spring-test which will be migrated in a separate commit.

See gh-23451
2019-08-17 11:36:58 +02:00
Sam Brannen 7538561a7a Polish ApplicationContextAwareProcessor
Due to recent changes, the (bean instanceof Aware) check is now
superfluous.
2019-08-10 14:24:10 +02:00
Sam Brannen 8b023b17c9 Polish contribution
See gh-23435
2019-08-09 15:04:07 +02:00
GungnirLaevatain 1dc2177a4a Avoid unnecessary processing in ApplicationContextAwareProcessor
This commit avoids unnecessary processing in the implementation of
postProcessBeforeInitialization() in ApplicationContextAwareProcessor
by immediately returning the supplied bean if it does not meet the
requirements for further processing.

Closes gh-23435
2019-08-09 14:54:05 +02:00
Sebastien Deleuze 23cd261b6b Deprecate AnnotationConfigApplicationContext { } Kotlin extension
Closes gh-23420
2019-08-06 11:28:32 +02:00
康智冬 5bb5b2b24d Fix grammar in package-info.java
Closes gh-23401
2019-08-02 13:40:25 +02:00
Phillip Webb 89d150d398 Resolve factoryBeanClass if necessary
Update `AbstractAutowireCapableBeanFactory.getTypeForFactoryBean` to
use fallback to `determineTargetType` if the factory bean definition
does not have a resolved class.

This is required for the case where a `@Configuration` class is picked
up via component scanning and has a bean type that has not yet been
resolved.

Closes gh-23338
2019-08-01 07:48:12 +01:00
Phillip Webb a6021cc968 Rename SearchStrategy.EXHAUSTIVE to TYPE_HIERARCHY
Rename `SearchStrategy.EXHAUSTIVE` from `MergedAnnotations` to
`SearchStrategy.TYPE_HIERARCHY`

See gh-23378
2019-07-31 13:52:53 +01:00
Phillip Webb 71a5308c78 Support FactoryBean bean definition attributes
Update `getTypeForFactoryBean` detection so that a bean definition
attribute can be used to supply the result. This commit allows projects
such as Spring Data to provide the result that would be supplied by
`getObjectType` early so that we don't need to initialize the
`FactoryBean` unnecessarily.

Closes gh-23338
2019-07-31 12:22:03 +02:00
Phillip Webb a0e462581f Consider generics for predicting FactoryBean types
Update the `FactoryBean` type prediction logic (primarily in the
`DefaultListableBeanFactory`) so that generic type information is
considered when calling `getBeanNamesForType` on a non-frozen
configuration.

Calling `getBeanNamesForType` with `allowEagerInit` disabled will now
detect `FactoryBean` variants as long as generic type information is
available in either the class or the factory method return type.

Closes gh-23338
2019-07-31 12:22:03 +02:00
Phillip Webb 2ee1ce61c0 Add missing variants of getBeanNamesForType
Update `ListableBeanFactory` and `BeanFactoryUtils` to add the missing
`getBeanNamesForType` methods that accept a `ResolvableType` rather
than a `Class`.

This completes the work started in 778a01943b.

Closes gh-23335
2019-07-31 12:22:03 +02:00
Juergen Hoeller 8ef557df2f Merge branch '5.1.x' 2019-07-30 17:34:29 +02:00
Juergen Hoeller c4622dbebc Polishing 2019-07-30 16:59:01 +02:00
Juergen Hoeller cdeb1fef5f Merge branch '5.1.x' 2019-07-20 18:23:00 +02:00
Juergen Hoeller b1e8ed182e Polishing 2019-07-20 17:53:54 +02:00