Commit Graph

3377 Commits

Author SHA1 Message Date
Vladyslav Baidak 0b2c2d04b2 Fix typo in Javadoc for BeanDefinitionDsl.kt
Closes gh-30798
2023-07-03 15:49:28 +02:00
Sam Brannen 3c05679a97 Polishing
See gh-30762
2023-06-30 14:04:37 +02:00
Yanming Zhou d8729a7c67 Polish variable name in ReschedulingRunnable
As a variable name, `initDelay` is applicable for `scheduleAtFixedRate`
and `scheduleWithFixedDelay` but not for `schedule`.

Closes gh-30762
2023-06-30 13:57:46 +02:00
Juergen Hoeller 60865eae4b Align ConcurrentMapCacheManager locking behavior with CaffeineCacheManager
Closes gh-30780
2023-06-30 10:39:53 +02:00
Juergen Hoeller 599ac58baa Avoid arithmetic overflow for large delay/period values
Closes gh-30754
2023-06-26 19:28:08 +02:00
Sam Brannen fa7300c1de Remove unused test code and polish 2023-06-25 15:31:15 +02:00
Sam Brannen db17a97ce8 Polishing 2023-06-25 15:18:59 +02:00
Johnny Lim 55f946c5a0 Fix incomplete AssertJ assertions
Closes gh-30743
2023-06-25 15:18:52 +02:00
Sam Brannen 3181dca5ef Support [package-]private init/destroy methods in AOT mode
Prior to this commit, private (and non-visible package-private)
init/destroy methods were not supported in AOT mode. The reason is that
such methods are tracked using their fully-qualified method names, and
the AOT support for init/destroy methods previously did not take
fully-qualified method names into account. In addition, the invocation
order of init/destroy methods differed vastly between standard JVM mode
and AOT mode.

This commit addresses these issues in the following ways.

- AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(),
  DisposableBeanAdapter.determineDestroyMethod(), and
  BeanDefinitionPropertiesCodeGenerator.addInitDestroyHint() now parse
  fully-qualified method names to locate the correct init/destroy
  methods.

- AbstractAutowireCapableBeanFactory and DisposableBeanAdapter delegate
  to a new MethodDescriptor record which encapsulates the parsing of
  fully-qualified method names; however,
  BeanDefinitionPropertiesCodeGenerator duplicates this logic since it
  resides in a different package, and we do not currently want to make
  MethodDescriptor public.

- Init/destroy methods detected via annotations (such as @PostConstruct
  and @PreDestroy) are now invoked prior to init/destroy methods that
  are explicitly configured by name or convention. This aligns with the
  invocation order in standard JVM mode; however,
  InitializingBean#afterPropertiesSet() and DisposableBean#destroy()
  are still invoked before annotated init/destroy methods in AOT mode
  which differs from standard JVM mode.

- Unit and integration tests have been updated to test the revised
  behavior.

Closes gh-30692
2023-06-24 14:22:17 +02:00
Sam Brannen 6d63890c56 Use Assumptions.abort() where appropriate 2023-06-24 14:13:22 +02:00
Sam Brannen 489c89b912 Remove unused test code 2023-06-24 14:12:58 +02:00
Sam Brannen 39bc7566df Stop printing to System.out in tests 2023-06-24 14:10:12 +02:00
Johnny Lim 433b72d493 Polish gh-29883 2023-07-10 22:13:12 +02:00
Sam Brannen 7bc731dfa6 Merge branch '6.0.x' 2023-07-10 19:07:09 +02:00
Juergen Hoeller 71bb45c87b Merge branch '6.0.x' 2023-07-09 16:56:45 +02:00
Juergen Hoeller 5243c2262a Support scheduler qualifier for reactive SubscribingRunnable as well
See gh-20818
2023-07-08 17:18:17 +02:00
Juergen Hoeller a0c80ffc06 Destroy local TaskSchedulerRouter which may contain local executor
See gh-20818
2023-07-08 15:55:25 +02:00
Juergen Hoeller a8614531ab Support for determining a target scheduler for a specific task
Introduces "scheduler" attribute on @Scheduled annotation.
TaskSchedulerRouter delegates to qualified/default scheduler.
ScheduledMethodRunnable exposes qualifier through SchedulingAwareRunnable.

Closes gh-20818
2023-07-08 15:37:04 +02:00
Juergen Hoeller f0fe58f0ec Move observation support classes to scheduling.support package
Avoids a package cycle between config and support (only config->support allowed).

See gh-29883
2023-07-08 14:57:02 +02:00
Sébastien Deleuze 8fb412ea74 Merge branch '6.0.x' 2023-07-08 11:11:37 +02:00
Juergen Hoeller bf99361abb Merge branch '6.0.x' 2023-07-08 00:58:58 +02:00
Juergen Hoeller 464b676ec5 Expose shutdown state in TaskRejectedException message
See gh-27090
2023-07-07 23:59:10 +02:00
Juergen Hoeller ddc3cf301a Merge branch '6.0.x'
# Conflicts:
#	spring-context/src/main/java/org/springframework/scheduling/concurrent/ExecutorConfigurationSupport.java
2023-07-07 13:51:08 +02:00
Juergen Hoeller b12115b61f Sophisticated lifecycle support for ThreadPoolTaskExecutor/Scheduler
Pause/resume capability through SmartLifecycle implementation.
ContextClosedEvent triggers early executor/scheduler shutdown.
Programmatic initiateShutdown() option for custom early shutdown.

Closes gh-30831
Closes gh-27090
Closes gh-24497
2023-07-07 13:04:52 +02:00
Sam Brannen d86750372a Improve Javadoc for @Configuration 2023-07-06 17:13:37 +02:00
Sam Brannen 299b86bae3 Merge branch '6.0.x' 2023-07-05 14:02:49 +02:00
rstoyanchev deaa493644 Add Visitor to HandlerMethodValidationException
Closes gh-30813
2023-07-04 17:19:58 +01:00
Juergen Hoeller 2a77665be7 Merge branch '6.0.x' 2023-07-04 15:59:38 +02:00
rstoyanchev 592ab0f350 Add ~.validation.method package
Extract classes from ~.validation.beanvalidation without a direct
dependency on beanvalidation.

See gh-30644
2023-07-03 15:05:51 +01:00
Sam Brannen 0da2241367 Merge branch '6.0.x' 2023-07-03 15:54:13 +02:00
Sam Brannen 37e8ef1542 Merge branch '6.0.x' 2023-07-03 15:50:17 +02:00
rstoyanchev 84e863f803 Refactoring in MethodValidationAdapter
Extract the default logic for resolving the name of an @Valid
parameter into an ObjectNameResolver, and use it when there isn't
one configured.

See gh-30644
2023-07-03 12:08:11 +01:00
rstoyanchev a481c7649f Refactor to prepare for method validation handling
To handle method validation errors in ResponseEntityExceptionHandler,
MethodValidationException and associated types should not depend on
Bean Validation. To that effect:

1. MethodValidationResult and ParameterValidationResult no longer make
the underlying ConstraintViolation set available, and instead expose
only the adapted validation errors (MessageSourceResolvable, Errors),
analogous to what SpringValidatorAdapter does. And likewise
MethodValidationException no longer extends ConstraintViolationException.

2. MethodValidationPostProcessor has a new property
adaptConstraintViolations to decide whether to simply raise
ConstraintViolationException, or otherwise to adapt the ConstraintViolations
and raise MethodValidationException instead, with the former is the default
for compatibility.

3. As a result, the MethodValidator contract can now expose methods that
return MethodValidationResult, which provided more flexibility for handling,
and it allows MethodValidationAdapter to implement MethodValidator directly.

4. Update Javadoc in method validation classes to reflect this shift, and
use terminology consistent with Spring validation in classes without an
explicit dependency on Bean Validation.

See gh-30644
2023-07-03 12:08:11 +01:00
rstoyanchev a8ea472121 Refactoring in MethodValidationResult
Remove throwIfViolationsPresent and replace with static factory
methods on MethodValidationException taking MethodValidationResult,
which makes handling more explicit and allows choice of what
exception to raise.

Update MethodValidationResult to expose the target, the method, and
forReturnValue flag, so the code handling an exception will have
access to all details.

See gh-30644
2023-07-03 12:08:11 +01:00
Sam Brannen b8f091e2f6 Merge branch '6.0.x' 2023-06-30 14:17:49 +02:00
Johnny Lim 41f8b6926f Polish gh-30013
See gh-30013
2023-06-30 14:02:15 +02:00
Juergen Hoeller 50074f0e96 Merge branch '6.0.x' 2023-06-30 10:40:37 +02:00
Sébastien Deleuze bd7e2d2875 Change restore logging to info level
Closes gh-30775
2023-06-29 17:20:51 +02:00
Brian Clozel c2e3fed8dc Align observations of @Scheduled with OTel conventions
This commit updates the `ScheduledTaskObservationDocumentation` to
better align the contributed KeyValues with OpenTelemetry conventions
for observations of code executions.

Instead of a "target.type" key with the bean class simple name, this
is now contributing the canonical class name of the bean under the
"code.namespace" key.
The "method.name" key is renamed to "code.function" and its values
remain unchanged.

Closes gh-30721
2023-06-27 22:20:06 +02:00
rstoyanchev d4ac90dae0 Support nested constructors in DataBinder
Closes gh-20806
2023-06-26 17:01:44 +01:00
rstoyanchev ea398d7b7e Support constructing target object in DataBinder
See gh-26721
2023-06-22 20:36:28 +01:00
Juergen Hoeller 3f40452511 Merge branch '6.0.x' 2023-06-26 19:36:20 +02:00
Sam Brannen 6072a537d9 Polish formatting 2023-06-25 19:13:27 +02:00
Sam Brannen aecebf7981 Ensure MethodValidationAdapterTests pass with default Locale other than English
Closes gh-30734
2023-06-25 19:12:41 +02:00
Sam Brannen 9127777c32 Merge branch '6.0.x'
# Conflicts:
#	spring-context/src/test/java/org/springframework/jmx/export/MBeanExporterTests.java
2023-06-25 15:34:10 +02:00
Johnny Lim 6c816c55d1 Fix incomplete AssertJ assertions
Closes gh-30743
2023-06-25 15:10:11 +02:00
Sam Brannen 209e02cf29 Merge branch '6.0.x' 2023-06-24 14:27:13 +02:00
Sam Brannen 19686adc01 Merge branch '6.0.x' 2023-06-24 14:15:05 +02:00
Sam Brannen cd4ab23fa9 Merge branch '6.0.x' 2023-06-22 14:55:43 +02:00
Sam Brannen da323d3335 Update copyright headers 2023-06-22 14:55:23 +02:00
Sam Brannen 5598dd2c34 Merge branch '6.0.x' 2023-06-22 13:54:04 +02:00
Sam Brannen 32f061a3e0 Polishing 2023-06-22 13:48:07 +02:00
Juergen Hoeller a6566bfd5f Merge branch '6.0.x' 2023-06-21 18:53:15 +02:00
Juergen Hoeller 09cf489c6b Test for supportsEventType mismatch with unrelated event type
See gh-30712
2023-06-21 18:24:38 +02:00
Juergen Hoeller 54e25e2fa6 Merge branch '6.0.x' 2023-06-21 17:18:55 +02:00
Juergen Hoeller dc2f513619 Correct supportsEventType checks for payload events
See gh-30712
2023-06-21 17:17:03 +02:00
Sam Brannen 83447663b4 Merge branch '6.0.x' 2023-06-21 16:21:34 +02:00
Sam Brannen 0eb33d09ac Ensure package-private init/destroy methods are always invoked
Prior to this commit, if an init/destroy method was package-private and
declared in a superclass in a package different from the package in
which the registered bean resided, a local init/destroy method with the
same name would effectively "shadow" the method from the different
package, resulting in only the local init/destroy method being invoked.

This commit addresses this issue by tracking package-private init
methods from different packages using their fully-qualified method
names, analogous to the existing support for private init/destroy
methods.

Closes gh-30718
2023-06-21 16:18:19 +02:00
Stephane Nicoll b581a79eed Merge branch '6.0.x' 2023-06-21 14:51:00 +02:00
Stephane Nicoll 6c42f374c8 Consistently set target type in generated code
Previously, a bean definition that is optimized AOT could have
different metadata based on whether its resolved type had a generic or
not. This is due to RootBeanDefinition taking either a Class or a
ResolvableType doing fundamentally different things. While the former
sets the bean class which is to little use with an instance supplier,
the latter specifies the target type of the bean.

This commit sets the target type of the bean, using the existing
setter methods that take either a class or a ResolvableType and set the
same attribute consistently.

Closes gh-30689
2023-06-21 14:45:19 +02:00
Sam Brannen 6535614d78 Merge branch '6.0.x' 2023-06-21 14:22:11 +02:00
Sam Brannen 2fd83aa764 Polish InitDestroyAnnotationBeanPostProcessor internals, etc. 2023-06-21 14:19:00 +02:00
Juergen Hoeller fa82683ce2 Merge branch '6.0.x' 2023-06-21 13:16:47 +02:00
Juergen Hoeller 714c3c59eb Accept unresolvable generics as long as raw event class matches
Closes gh-30712
2023-06-21 13:15:35 +02:00
Juergen Hoeller f1fb8cf03e Polishing 2023-06-20 22:53:12 +02:00
Juergen Hoeller 18c6aceee7 Consistent guard for Reactive Streams presence
Closes gh-30707
2023-06-20 22:51:23 +02:00
Brian Clozel 09cb844421 Instrument Scheduled methods for observability
This commit enhances the `ScheduledAnnotationBeanPostProcessor` to
instrument `@Scheduled` methods declared on beans. This will create
`"tasks.scheduled.execution"` observations for each execution of a
scheduled method. This supports both blocking and reactive variants.

By default, observations are no-ops; developers must configure the
current `ObservationRegistry` on the `ScheduledTaskRegistrar` by using a
`SchedulingConfigurer`.

Closes gh-29883
2023-06-19 08:55:08 +02:00
Sam Brannen 2dd34cf967 Clean up warnings in tests 2023-06-15 16:26:34 +02:00
Sam Brannen a2072de391 Update copyright headers 2023-06-15 16:21:13 +02:00
Sam Brannen 526d9eae7f Merge branch '6.0.x' 2023-06-15 16:20:19 +02:00
Sam Brannen 4565bcd757 Update copyright headers 2023-06-15 16:19:58 +02:00
Juergen Hoeller e344f3f869 Consistent treatment of new Spring system properties
See gh-30606
See gh-30571
2023-06-14 18:27:06 +02:00
Juergen Hoeller 326e27eab2 Merge branch '6.0.x' 2023-06-14 12:57:59 +02:00
Juergen Hoeller 3415b04c73 Use nanosecond precision for scheduling (aligned with calculations)
Closes gh-30666
2023-06-14 12:57:17 +02:00
Juergen Hoeller 1f068fcdb8 Rename checkpoint property to "spring.context.checkpoint"
See gh-30606
2023-06-13 19:06:46 +02:00
rstoyanchev 85d81024a4 Add MethodParameter[] input to MethodValidationAdapter
This allows re-use of existing MethodParameter instances from controller
methods with cached metadata, and also ensures additional capabilities
such as looking up parameter annotations on interfaces.

See gh-29825
2023-06-13 17:40:57 +01:00
Sam Brannen f7367ceae5 Merge branch '6.0.x' 2023-06-12 16:44:48 +02:00
Sam Brannen 3fb98b6a97 Polishing 2023-06-12 16:43:56 +02:00
Roland Weisleder dc4f46df9f Fix markup issue in Javadoc of QuartzCronField
Closes gh-30646
2023-06-12 16:40:11 +02:00
Stephane Nicoll 61c9cbc3f5 Retain active profiles used during AOT processing
This commit makes sure that profiles that have been explicitly enabled
during AOT optimizations are automatically enabled when using those
optimizations.

If other profiles are set at runtime, they take precedence over the ones
defined during AOT processing.

Closes gh-30421
2023-06-12 16:33:35 +02:00
Juergen Hoeller 6501176081 Merge branch '6.0.x' 2023-06-12 12:59:55 +02:00
Juergen Hoeller f8c8873c99 Document which @Scheduled attributes support SpEL expressions
Closes gh-29290
2023-06-12 12:57:10 +02:00
Rossen Stoyanchev bd054a4918 Add method validation to Spring MVC
See gh-29825
2023-06-12 11:37:55 +01:00
rstoyanchev cb04c3b335 Expose isReturnValue from MethodValidationException
See gh-29825
2023-06-12 11:37:55 +01:00
rstoyanchev 5c5d8e61ae Add BindingResultNameResolver option
See gh-29825
2023-06-12 11:37:55 +01:00
rstoyanchev 0fef380202 Add MethodValidator
See gh-29825
2023-06-12 11:37:55 +01:00
Rossen Stoyanchev cc8361cd93 Add MethodValidationResult
See gh-29825
2023-06-12 11:37:55 +01:00
rstoyanchev 8b53fecc06 Use List for violations in ParameterErrors
See gh-29825
2023-06-12 11:37:55 +01:00
Rossen Stoyanchev 425d5a94cb Adapt ConstraintViolation's from method validation
See gh-29825
2023-06-12 11:37:55 +01:00
rstoyanchev 38abee00e2 Rename MethodValidationTests and polishing
See gh-29825
2023-06-12 11:37:55 +01:00
rstoyanchev 082784e023 Extract delegate from MethodValidationInterceptor
See gh-29825
2023-06-12 11:37:55 +01:00
Sam Brannen dbd32f8f11 Merge branch '6.0.x' 2023-06-09 10:30:16 +02:00
Johnny Lim ea9c0ae6c0 Fix test fixture value in QualifierConfiguration
Closes gh-30624
2023-06-09 10:29:39 +02:00
Juergen Hoeller ef2b47e202 Merge branch '6.0.x' 2023-06-08 17:46:19 +02:00
Juergen Hoeller c16f582ed8 Consistent equals implementations in AOP support classes 2023-06-08 17:42:49 +02:00
Juergen Hoeller 6931106c5e Redesign inner Pointcut implementations as standalone classes
Avoids exposure of implicit Advisor instance state in Pointcut instance.

See gh-30621
2023-06-08 17:42:49 +02:00
Juergen Hoeller 045df81f14 Reduce ProxyCallbackFilter to key-only role after class generation
Avoids memory leaks from ProxyCallbackFilter-contained Advisors.
Includes consistent ProxyCallbackFilter#equals/hashCode methods.

Closes gh-26266
Closes gh-30615
2023-06-08 17:42:49 +02:00
Juergen Hoeller 1b62b6dd89 Merge branch '6.0.x' 2023-06-07 17:23:09 +02:00
Juergen Hoeller 2c8d1b7bff Polishing 2023-06-07 17:21:59 +02:00
Juergen Hoeller b3597f3d99 Polishing 2023-06-07 17:11:46 +02:00
Sam Brannen 73e9de7b5f Simplify Javadoc 2023-06-07 17:08:11 +02:00
Arjen Poutsma df7223f39c Remove APIs marked for removal
See gh-30604
2023-06-07 10:20:27 +02:00
Juergen Hoeller 7f6f47b97b Property-driven onRefresh checkpoint during application context bootstrap
Closes gh-30606
2023-06-06 19:18:34 +02:00
Sam Brannen 93deb0a584 Polishing 2023-06-06 11:54:38 +02:00
Sam Brannen 05eab703cc Polishing 2023-06-06 11:29:25 +02:00
Simon Baslé 35052f2113 Support `@Scheduled` fixedDelay/fixedRate on Publisher-returning methods
This commit adds support for `@Scheduled` annotation on reactive
methods and Kotlin suspending functions.

Reactive methods are methods that return a `Publisher` or a subclass
of `Publisher`. The `ReactiveAdapterRegistry` is used to support many
implementations, such as `Flux`, `Mono`, `Flow`, `Single`, etc.
Methods should not take any argument and published values will be
ignored, as they are already with synchronous support.

This is implemented in `ScheduledAnnotationReactiveSupport`, which
"converts" Publishers to `Runnable`. This strategy keeps track of
active Subscriptions in the `ScheduledAnnotationBeanPostProcessor`,
in order to cancel them all in case of shutdown.
The existing scheduling support for tasks is reused, aligning the
triggering behavior with the existing support: cron, fixedDelay and
fixedRate are all supported strategies.

If the `Publisher` errors, the exception is logged at warn level and
otherwise ignored. As a result new `Runnable` instances will be
created for each execution and scheduling will continue.
The only difference with synchronous support is that error signals
will not be thrown by those `Runnable` tasks and will not be made
available to the `org.springframework.util.ErrorHandler` contract.
This is due to the asynchronous and lazy nature of Publishers.

Closes gh-23533
Closes gh-28515
2023-06-05 14:13:44 +02:00
Juergen Hoeller e82dd14f0f Merge branch '6.0.x'
# Conflicts:
#	spring-beans/src/main/java/org/springframework/beans/factory/support/DisposableBeanAdapter.java
2023-06-02 23:30:04 +02:00
Juergen Hoeller 4b8adf2dcc Polishing 2023-06-02 23:28:14 +02:00
Juergen Hoeller b738a20233 Consistently publish events from CompletableFuture
Closes gh-30578
2023-06-02 23:25:35 +02:00
Juergen Hoeller 25a1e8d414 Reset common caches before LifecycleProcessor-initiated checkpoint
See gh-29921
2023-06-02 20:42:37 +02:00
Juergen Hoeller 322cbca0dc Support for async/reactive close methods (e.g. R2DBC)
Closes gh-26991
2023-06-02 20:40:55 +02:00
Remus Richard Dumitrache 4d8f6c1b41
Support parsing long millisecond timestamps in `InstantFormatter`
This commit adds support of parsing a simple long from a String and
turning it to an `Instant` by considering it represents a timestamp in
milliseconds (see `Instant.ofEpochMilli`). Failing to parse a long from
the String, the previous algorithm is used: first check for an RFC-1123
representation then an ISO_INSTANT representation.

See gh-30312
Closes gh-30546
2023-05-26 12:08:26 +02:00
Juergen Hoeller cabc41bcd6 Merge branch '6.0.x' 2023-05-25 18:46:50 +02:00
Juergen Hoeller 5e625c8d2e Polishing 2023-05-25 18:45:32 +02:00
Juergen Hoeller 5441796675 Polishing 2023-05-23 20:01:28 +02:00
Sam Brannen b5902f4fbf Suppress unused warnings in tests 2023-05-23 15:09:10 +02:00
Sam Brannen 791802fdf7 Merge branch '6.0.x' 2023-05-23 12:41:26 +02:00
Sam Brannen a455317122 Treat directly registered class as configuration 'lite' mode candidate
Prior to this commit, if a non-annotated [1] class was registered
directly with an ApplicationContext -- for example, via
AnnotatedBeanDefinitionReader, AnnotationConfigApplicationContext, or
@ContextConfiguration -- it was not considered a configuration class in
'lite' mode unless @Bean methods were declared locally. In other words,
if the registered class didn't declare local @Bean methods but rather
extended a class that declared @Bean methods, then the registered class
was not parsed as a @Configuration class in 'lite' mode, and the @Bean
methods were ignored.

Whereas, a non-annotated class registered via @Import is always
considered to be a configuration class candidate.

To address this discrepancy between @Import'ed classes and classes
registered directly with an ApplicationContext, this commit treats any
class registered via AnnotatedBeanDefinitionReader as a @Configuration
class candidate with @Bean 'lite' mode semantics.

[1] In this context, "non-annotated" means a class not annotated (or
meta-annotated) with @Component, @ComponentScan, @Import, or
@ImportResource.

Closes gh-30449
2023-05-23 12:19:58 +02:00
Sébastien Deleuze d99c2cf31e Refine JVM checkpoint/restore support
This commit:
 - Refine the wording used in logs and Javadoc
 - Avoid calling awaitPreventShutdownBarrier() in afterRestore()
 - Add logs to print the restart duration

See gh-29921
2023-05-12 09:29:35 +02:00
Juergen Hoeller 841124af75 Merge branch '6.0.x' 2023-05-10 17:19:39 +02:00
Juergen Hoeller c8927ae753 Polishing 2023-05-10 17:18:31 +02:00
Juergen Hoeller e228f4ba64 Consistent pre-resolution of event type vs payload type
Restores proper event type propagation to parent context.
Selectively applies payload type to given payload object.
Also reuses cached type for regular ApplicationEvent now.

Closes gh-30360
2023-05-10 17:17:48 +02:00
Simon Baslé dbc42f56b3 Merge branch '6.0.x' 2023-05-10 15:18:57 +02:00
Simon Baslé c733ae0f22 Fix ApplicationListenerMethodAdapter#supportsEventType check
This commit fixes the check by avoiding a fallback to eventType's
hasUnresolvableGenerics(). This could previously lead to checking a
generic event type `A<T>` against a listener which accepts unrelated
`B` and return `true` despite the inconsistency.

Note that this wouldn't necessarily surface to the user because there is
a `catch (ClassCastException e)` down the line, which was primarily put
in place to deal with lambda-based listeners but happens to catch an
exception thrown due to the bad result of `supportsEventType`.

The `supportsEventType` now matches generic `PayloadApplicationEvent`
types with a raw counterpart, using the above fallback only in that case
and otherwise ultimately returning `false`.

Closes gh-30399
2023-05-10 15:00:11 +02:00
Sam Brannen 5e52259fb3 Suppress warnings in tests 2023-05-10 14:27:43 +02:00
Stephane Nicoll 993a69d3a9 Deprecate spring context indexer
This commit deprecates the context indexer as our efforts on the AOT
engine cover the indexer in a much broader fashion.

Closes gh-30431
2023-05-10 09:13:57 +02:00
Stephane Nicoll eb240016ed Merge branch '6.0.x' 2023-05-09 14:52:49 +02:00
Stephane Nicoll c1f6d7197b Add support for InjectionPoint with AOT
This commit reviews BeanInstanceSupplier to reuse more code from
ConstructorResolver. Previously, the autowired argument resolution was
partially duplicated and this commit introduces a new common path via
RegisteredBean#resolveAutowiredArgument.

Closes gh-30401
2023-05-09 14:52:23 +02:00
Juergen Hoeller 2c7e8661cf Respect TaskDecorator configuration on DefaultManagedTaskExecutor
Closes gh-30442
2023-05-08 12:02:25 +02:00
Juergen Hoeller 697d5e6247 Configuration options for virtual threads (on JDK 21)
VirtualThreadDelegate built on JDK 21 for multi-release jar.
Includes dedicated VirtualThreadTaskExecutor as lean option.
Includes setVirtualThreads flag on SimpleAsyncTaskExecutor.
Includes additional default methods on AsyncTaskExecutor.

Closes gh-30241
2023-05-08 11:22:47 +02:00
Juergen Hoeller d8d7e0a762 Deprecate default constructor on ConcurrentTaskExecutor/Scheduler
Includes revision of null Executor configuration.
Respects TaskDecorator configuration on DefaultManagedTaskExecutor.

Closes gh-27914
2023-05-08 11:21:29 +02:00
Sébastien Deleuze 9fec516560 Skip CRaC support with native images
Skip CRaC support with native images to avoid compiling related
infrastructure to the native image and to fix tests via
gh-30422.

See gh-30242
2023-05-04 15:36:29 +02:00
Stephane Nicoll 69cde11a51 Merge branch '6.0.x' 2023-05-04 12:23:46 +02:00
Stephane Nicoll 44b427c3e1 Add AOT support for Qualifiers
This commit handles AutowiredCandidateQualifier instances, rather than
relying on qualifiers being statically defined and meta-annotated with
`@Qualifier`.

Closes gh-30410
2023-05-04 12:17:07 +02:00
Juergen Hoeller 7d2047cdbd Prevent JVM shutdown before checkpoint
See gh-30242
2023-05-03 18:16:32 +02:00
Juergen Hoeller c76116b970 Keep CracResourceAdapter strongly reachable
See gh-30242
2023-05-03 17:50:36 +02:00
Juergen Hoeller 8d604350e4 Support for Project CRaC in DefaultLifecycleProcessor
Includes stopForRestart/restartAfterStop functionality.

Closes gh-30242
2023-05-03 16:01:41 +02:00
Stephane Nicoll 834e694e94 Merge branch '6.0.x' 2023-04-26 14:39:58 +02:00
Stephane Nicoll 02132bd060 Infer resource hints for PropertySource#value
This commit adds a resource hints for the target(s) of a @PropertySource
declaration.

Closes gh-30376
2023-04-26 14:13:19 +02:00
Stephane Nicoll f6875b11ff Generate missing hints for custom PropertySource factories
Closes gh-30175
2023-04-26 13:40:48 +02:00
Sam Brannen ce3e9b0c29 Polishing 2023-04-26 11:21:34 +02:00
Sam Brannen 7e0620a143 Use new Environment.matchesProfiles() method 2023-04-26 11:09:38 +02:00
Sam Brannen 982a094646 Rename determineResource() to resolveResource()
See gh-30369
2023-04-25 11:35:00 +02:00
Sam Brannen dfe320f172 Reorganize methods in ReloadableResourceBundleMessageSource
See gh-30369
2023-04-25 11:08:56 +02:00
Sam Brannen 2537c7c735 Polish Javadoc in ReloadableResourceBundleMessageSource
See gh-30369
2023-04-25 11:08:56 +02:00
Simon Baslé e63d89973a
Add ReloadableResourceBundleMessageSource Resource selection hook
This commit enables sub-classes to better customize resource selection
and resource loading in `ReloadableResourceBundleMessageSource`, without
a need to duplicate the caching logic of `refreshProperties`.

See gh-30334
Closes gh-30369
2023-04-24 17:57:45 +02:00
Han Li b311088f5a
Optimize DefaultLifecycleProcessor::stopBeans
This commit optimizes `DefaultLifecycleProcessor::stopBeans` by using a
`TreeMap` when gathering the `LifecycleGroup`s during stopBeans. It also
switches to a functional style using `computeIfAbsent`.

Finally, it further optimizes `LifecycleGroup` by removing sorting of
`LifecycleGroupMember` members list entirely, turning the class into a
simple record.
This is possible because the members list is already comprised of
members which all share the same phase value, so sorting according to
each member's phase is redundant.

Closes gh-30361

Co-authored-by: Simon Baslé <sbasle@vmware.com>
2023-04-24 16:45:24 +02:00
Arjen Poutsma 3c57d5518a Polish contribution
- Split Validator::of into two factory methods:
  - forInstanceOf using Class::isAssignableFrom
  - forType using Class::equals
- Moved anonymous implementation into TypedValidator with default access

Closes gh-30341
2023-04-19 15:17:31 +02:00
Toshiaki Maki 5f98afc180 Introduce functional factory methods in Validator
This commit introduces `of` method in `Validator` to provide a way to
create a validator for the specific type `<T>` using `BiConsumer<T, Errors>`
and define the validator in a functional way.
This also eliminates the boilerplate for implementing the `supports` method.
2023-04-19 13:54:51 +02:00
Sam Brannen e746230de6 Introduce ObjectUtils.nullSafeConciseToString()
ObjectUtils.nullSafeToString(Object) exists for generating a string
representation of various objects in a "null-safe" manner, including
support for object graphs, collections, etc.

However, there are times when we would like to generate a "concise",
null-safe string representation that does not include an entire object
graph (or potentially a collection of object graphs).

This commit introduces ObjectUtils.nullSafeConciseToString(Object) to
address this need and makes use of the new feature in FieldError and
ConversionFailedException.

Closes gh-30286
2023-04-05 14:13:28 +02:00
Krzysztof Krasoń 1734deca1e
Refactor AssertJ assertions into more idiomatic ones
This commit refactors some AssertJ assertions into more idiomatic and
readable ones. Using the dedicated assertion instead of a generic one
will produce more meaningful error messages. 

For instance, consider collection size:
```
// expected: 5 but was: 2
assertThat(collection.size()).equals(5);
// Expected size: 5 but was: 2 in: [1, 2]
assertThat(collection).hasSize(5);
```

Closes gh-30104
2023-04-04 17:34:07 +02:00
Sam Brannen 49a4ed2ffa Improve Javadoc for @PropertySource 2023-04-01 18:15:19 +02:00
Brian Clozel 3a36d51473 Polish
See gh-29246
2023-03-30 14:49:11 +02:00
Brian Clozel fe6589d5af Add runtime hint test for inherited destroy methods
This commit ensures that init/destroy methods that are provided as
default methods from interfaces are properly covered by runtime hints at
runtime.

Closes gh-29246
2023-03-30 14:42:19 +02:00
Brian Clozel b374824319 Contribute introspection hints on registered beans
Prior to this commit, reflection hints registered for beans was
selectively applied to only consider the methods that we'll actually
need reflection on at runtime. This would rely on an undocumented
behavior of GraalVM Native where calling `getDeclaredMethods` on a type
would only return known metadata at runtime, ignoring the ones that were
not registered during native compilation.

As of oracle/graal#5171, this behavior is now fixed in GraalVM and
aligns with the JVM behavior: all methods will be returned. This means
that if during native compilation, introspection was not registered for
the type a new `MissingReflectionMetadataException` will be raised.

As a follow up of #29205, this commit contributes the "introspection on
declared method" reflection hint for all registered beans.

Closes gh-29246
2023-03-29 21:16:59 +02:00
Juergen Hoeller b2be07c73c Polishing 2023-03-28 13:26:29 +02:00
Sam Brannen db29b65399 Polishing 2023-03-24 16:05:40 +01:00
Juergen Hoeller 88bc504625 Skip validation constraint hint inference if no provider available
Closes gh-30130
2023-03-17 17:36:31 +01:00
Sam Brannen e17f5c50a8 Update copyright headers 2023-03-13 21:53:40 +01:00
Sam Brannen 00be19c647 Consistently declare Object::equals argument as @Nullable 2023-03-13 21:43:21 +01:00
Sam Brannen a6dab10309 Update code regarding null-safety semantics
See gh-30083
2023-03-13 21:19:46 +01:00
Sam Brannen b617e16d8d Polishing 2023-03-13 21:16:02 +01:00
Sam Brannen 9cf7b0e230 Polishing 2023-03-12 18:38:50 +01:00
Sébastien Deleuze c20efba45c End javadoc generated AOT with a period consistently
Closes gh-29357
2023-03-07 11:20:37 +01:00
Sam Brannen 24de8c6f4c Apply "instanceof pattern matching" in remainder of spring-context module
See gh-30067
2023-03-05 19:09:32 +01:00
Sam Brannen e5d20a4f9d Convert EventExpressionRootObject to a record 2023-03-05 19:09:32 +01:00
Sam Brannen 3854861a8a Polishing 2023-03-03 15:39:24 +01:00
Juergen Hoeller f8cb0fa2a0 Custom resolution of preferred constructors for createBean(Class)
Avoids side effects of traditional AUTOWIRE_CONSTRUCTOR algorithm.

Closes gh-30041
2023-03-02 12:54:26 +01:00
Sam Brannen 00c2c1d2a1 Polish "Support @Value for record injection"
See gh-28774
2023-02-28 13:12:15 +01:00
nanfeng 7c9fc575ff Support @Value for record injection
Add @Value support for record injection by disabling populateBean() for
records, since records are immutable.

See gh-28770
Closes gh-28774
2023-02-28 13:01:13 +01:00
Sébastien Deleuze 79f43041ad Catch defensively validator exceptions in AOT processing
An ArrayIndexOutOfBoundsException is thrown by
Validator.getConstraintsForClass when processing Kotlin beans
with extensions functions (Kotlin or Hibernate Validator bug).

This commit catches those exceptions and report them as warning
without the full stactrace, and report as well other
ones thrown as errors with the full stracktrace.

Closes gh-30037
2023-02-27 12:06:37 +01:00
Sam Brannen edb4a3467a Update copyright headers 2023-02-26 18:37:18 +01:00
Sam Brannen 024d02225c Apply "instanceof pattern matching" to remaining Validation classes 2023-02-26 18:37:18 +01:00
Sam Brannen 9305a64a50 Polish contribution
See gh-29994
2023-02-26 18:30:14 +01:00
divcon 40672c3715 Apply "instance of patten matching" in context and messaging modules
Closes gh-29994
2023-02-26 18:30:14 +01:00
Sam Brannen 7c50464bba Polishing 2023-02-26 18:30:14 +01:00
Sébastien Deleuze 6825a842b5 Support package private methods on CGLIB proxies with AOT
Closes gh-29582
Closes gh-29764
2023-02-24 17:00:41 +01:00
AlexElin 3677d3597b Improve `@Lazy`'s javadoc by adding @code tag 2023-02-23 17:27:01 +00:00
Sam Brannen b437b7be34 Introduce test for perthis with @Aspect and shared pointcut
This commit modifies PerThisAspect (which is used indirectly in
AspectJAutoProxyCreatorTests.perThisAspect()) so that it uses a shared
@Pointcut for both the @Aspect and @Around declarations, in order to
refute claims made in gh-29998 that the documentation in the reference
manual is incorrect.
2023-02-20 17:23:07 +01:00
Sam Brannen 2d56505ea9 Polishing 2023-02-20 16:49:27 +01:00
Sam Brannen 2e1374b459 Update copyright headers 2023-02-19 13:41:36 +01:00
Johnny Lim ce3be72e7f Polish 2023-02-15 22:22:58 +09:00
Johnny Lim 431ae03447 Polish
Closes gh-29928
2023-02-09 09:54:19 +01:00
Juergen Hoeller b8827d8e11 Clarify postProcessBeanFactory lifecycle state
Closes gh-29064
2023-02-01 18:18:37 +01:00
Juergen Hoeller c0c9ba5c2c Polishing 2023-01-31 16:14:32 +01:00
Sam Brannen f5a39308a0 Polishing 2023-01-31 11:54:21 +01:00
Johnny Lim e4ceb80678 Use EnumMap for DateFormatter.ISO_PATTERNS again
This commit changes to use `EnumMap` for `DateFormatter.ISO_PATTERNS`
again by partially reverting commit ba136dcf40.

See gh-29321
Closes gh-29485
2023-01-31 11:52:25 +01:00
Sam Brannen d5b0782700 Polishing 2023-01-31 10:10:44 +01:00
Sébastien Deleuze 89c7c6e9dd Fix bean validation on suspending function parameters
This commit leverages Hibernate Validator's own internal use
of standard Java reflection to perform validation on suspending
function, which fixes the ArrayIndexOutOfBoundsException previously
observed.

Validation of suspending function return values remains unsupported
as Hibernate Validator is not Coroutines aware.

Closes gh-23499
2023-01-31 09:41:47 +01:00
Sam Brannen 9b0929c392 Update copyright headers 2023-01-30 13:00:22 +01:00
Arjen Poutsma af21ebe6c6 Fix CronExpression::parse javadoc
Closes gh-29884
2023-01-30 11:49:34 +01:00
Sam Brannen e0f60dc09d Apply "instanceof pattern matching" in spring-context and polishing
See gh-29222
2023-01-29 14:21:15 +01:00
Adam Ostrožlík 8783075e40 Apply "instanceof pattern matching" and minor refactorings in spring-context
Closes gh-29222
2023-01-29 13:52:43 +01:00
Sam Brannen e3fb0a39a2 Clean up compiler warnings 2023-01-28 21:18:19 +01:00
Sam Brannen 75046bbea0 Update copyright headers 2023-01-28 20:42:21 +01:00
rstoyanchev 6a6a35a0b9 Support method validation for interface-only proxies
Closes gh-29782
2023-01-27 14:46:22 +00:00
Sébastien Deleuze 57b6f7e494 Infer hints for custom constraint validators
This commit introduces a BeanValidationBeanRegistrationAotProcessor
which adds reflection hints for custom ConstraintValidator discovered
on beans constructors, methods and properties.

Closes gh-29823
2023-01-23 10:15:58 +01:00
Sam Brannen 3f148c2aaa Avoid warnings / Polishing 2023-01-20 15:22:47 +01:00
Sam Brannen 58872c79ee Update copyright headers 2023-01-20 14:17:53 +01:00
Sam Brannen 24f18275dd Stop referring to "Spring 3.x" features in documentation and code 2023-01-20 14:13:18 +01:00
Sam Brannen 0502d18e3d Update copyright headers 2023-01-19 16:20:03 +01:00
Sam Brannen c4c786596f Migrate to Mockito.mock(T...) where feasible 2023-01-19 16:20:02 +01:00
Sam Brannen a4956dfe26 Update copyright headers 2023-01-11 13:52:20 +01:00
Krzysztof Krason afb8a0d1b1 Use new Java features (switch expressions, text blocks, new JDK methods)
Closes gh-29747
2023-01-11 13:51:28 +01:00
Sébastien Deleuze 4396801933 Add reflection hints for Kotlin reflection on functions
Kotlin reflection API invocation on a specific function
may require iterating on all Java methods to find the right
Kotlin function. As a consequence, this commit adds introspection
hints on the class declared methods for all Kotlin beans since
the impact on the footprint is low.

Closes gh-29663
2023-01-10 14:49:26 +01:00
Sam Brannen 0bfddbc9cb Polishing 2022-12-18 13:20:46 +01:00
Sam Brannen 7fe78b745f Polish Javadoc 2022-12-13 13:44:03 +01:00
Sam Brannen f4bc9ffb98 Reintroduce component index support for Jakarta annotations
Spring Framework 6.0 GA introduced a regression in the component index
support for Jakarta annotations such as @Named and @ManagedBean.

Prior to this commit, @Named and @ManagedBean components were
registered in the component index at build time; however, component
scanning failed to find those component at run time.

This commit updates ClassPathScanningCandidateComponentProvider so that
`jakarta.*` annotation types are once again supported for component
scanning via the component index at run time.

Closes gh-29641
2022-12-06 16:23:31 -05:00
Sam Brannen e124e802a3 Polishing 2022-12-06 16:23:31 -05:00
Sam Brannen c24a51323d Reinstate test for JmxUtils.locateMBeanServer() 2022-12-03 18:23:41 -05:00
Juergen Hoeller d5732fed45 Polishing 2022-12-01 17:46:31 +01:00
Johnny Lim 74ec10bf3a Polish
Closes gh-29619
2022-12-01 17:34:33 +01:00
Sam Brannen 1de9d123a5 Update Javadoc for MBeanTestUtils 2022-11-30 15:15:51 +01:00
Sam Brannen ad60164911 Update copyright headers for source code changed since August 2022
The changes in this commit were performed using the newly introduced
update_copyright_headers.sh script.
2022-11-29 19:38:42 +01:00
Sam Brannen a88dbbec98 Apply project formatting rules for ternary operator
Discovered via RegEx: ^\s+\?
2022-11-29 17:51:13 +01:00
Juergen Hoeller 8e5eb84da1 Consistently register CGLIB hints for lazy resolution proxy classes
Core JDK/CGLIB proxy registration code extracted to ClassHintUtils.

Closes gh-29584
2022-11-26 13:38:34 +01:00
Juergen Hoeller 284cf3ecf2 Rely on standard parameter name resolution in Bean Validation 3.0
Just configuring additional Kotlin reflection if Kotlin is present.

Closes gh-29566
2022-11-24 12:01:51 +01:00
Sam Brannen 7fcd1de8e3 Use AssertJ's isEmpty() instead of hasSize(0)
Achieved via global search-and-replace.
2022-11-22 17:11:50 +01:00
Sam Brannen d5b0b2b1a1 User AssertJ's hasSize() for arrays
Achieved via global search-and-replace.
2022-11-22 17:03:45 +01:00
Sam Brannen 36f7597f25 Use AssertJ's hasSize() for collections and maps
Achieved via a global search-and-replace.
2022-11-22 16:50:10 +01:00
Sam Brannen f9f8f2d89e Polishing 2022-11-22 16:27:45 +01:00
Sam Brannen 43f8d9e084 Apply 'instanceof pattern matching' 2022-11-22 16:27:34 +01:00
Sam Brannen d32027df92 Apply 'instanceof pattern matching' 2022-11-22 15:11:37 +01:00
jiangying b130ff36d9
Fix Javadoc link text in BindingResult
Closes gh-29551
2022-11-22 13:38:57 +01:00
Sam Brannen 917c41fd52 Use Set.of() for constant sets where appropriate 2022-11-21 16:49:07 +01:00
Sam Brannen d0d5730f7f Suppress "removal" warnings in CronSequenceGeneratorTests 2022-11-16 12:30:10 +01:00
Arjen Poutsma 9be6cea012 Polishing deprecated methods
Added since and forRemoval to Deprecated methods.
2022-11-16 09:58:04 +01:00
Sam Brannen abf3400c07 Use Assert.state() where appropriate 2022-11-15 12:31:10 +01:00
Sam Brannen 2aa78889d2 Use consistent wording in precondition error messages 2022-11-15 12:31:01 +01:00
Sam Brannen 0b21c16fa8 Suppress unused warning in test code 2022-11-14 20:41:47 +01:00
Sam Brannen eb91d21ada Polishing 2022-11-13 18:21:56 +01:00
Stephane Nicoll da4b539f20 Stop generating generic type as Object for unresolved generics
Closes gh-29454
2022-11-09 12:00:34 +01:00
Juergen Hoeller 70bb785ed6 Turn nested generic FactoryBean type into resolved Class for fallback match
See gh-29385
2022-11-09 11:24:50 +01:00
Juergen Hoeller 0e9eab55ce Unwrap nested generic type within FactoryBean target type if necessary
Closes gh-29385
2022-11-08 20:22:12 +01:00
Sam Brannen f26a7dee97 Fix broken tests, update copyright dates, and polish
See gh-29414
2022-11-08 20:07:53 +01:00
Kulwant Singh b2c8546013 Rely on automatic boxing/unboxing in tests
Closes gh-29414
2022-11-08 19:38:03 +01:00
Sam Brannen 95f3337bb5 Revise contribution
This commit reverts changes to AbstractCacheManager since iterating
over the caches in a for-loop and a stream is duplicated effort.

This commit reverts changes to DefaultRenderingResponseBuilder,
RouterFunctions, and OriginHandshakeInterceptor since order matters for
those use cases: they were originally based on the semantics of
LinkedHashSet or LinkedHashMap; whereas, Set.copyOf() and Map.copyOf()
do not provide any guarantees regarding ordering.

This commit also applies analogous changes to "sibling" implementations
across Servlet mocks as well as Web MVC and WebFlux.

See gh-29321
2022-11-08 14:14:29 +01:00
divcon ba136dcf40 Replace use of Collections.unmodifiable*() methods where appropriate
Closes gh-29321
2022-11-08 13:51:31 +01:00
Juergen Hoeller 86d45578d9 Introduce findAllAnnotationsOnBean variant on ListableBeanFactory
Closes gh-29446
2022-11-08 13:29:33 +01:00
Sam Brannen e1010a179f Merge branch '5.3.x'
# Conflicts:
#	spring-context/src/test/java/org/springframework/context/annotation/Gh29105Tests.java
2022-11-08 12:27:40 +01:00
Sam Brannen dedbbf0a79 Avoid warnings in tests 2022-11-08 12:04:56 +01:00
Sam Brannen c3fca0a826 Always register root directory for registered resource hints
See gh-29403
2022-10-31 14:21:07 +01:00
Sam Brannen 29f085bd1a Automatically register directories for registered resource hints
When a hint such as `graphql/*.*` is registered for resources that are
looked up via classpath scanning using a pattern such as
`classpath*:graphql/**/*.graphqls`, an appropriate pattern is in fact
registered in the generated `resource-config.json` file for GraalVM
native images; however, classpath scanning fails since GraalVM
currently does not make the `graphql` directory automatically available
as a classpath resource.

This can be very confusing and cumbersome for users since a file such
as `graphql/schema.graphqls` will not be discovered via classpath
scanning even though the file is present in the native image filesystem.

To address this, this commit automatically registers resource hints for
enclosing directories for a registered pattern.

If the GraalVM team later decides to perform automatic directory
registration, we can then remove the code introduced in conjunction
with this issue.

Closes gh-29403
2022-10-30 19:02:39 +01:00
Sébastien Deleuze a1bc539d80 Support multiple @ImportRuntimeHints in the type hierarchy
This commit copies and adapts the logic from
DefaultListableBeanFactory#findMergedAnnotationOnBean
private method to make it suitable for returning multiple
annotations found in the type hierarchy in order
to support this use case with @ImportRuntimeHints.

Closes gh-29361
2022-10-24 10:56:30 +02:00
Stephane Nicoll e749cd1ef1 Add constructor introspection hint on Configuration class target
See gh-29358
2022-10-20 12:33:05 +02:00
Juergen Hoeller 5ff5553878 Adapted test for reflection hints on proxied user classes
See gh-29335
2022-10-20 09:35:57 +02:00
Juergen Hoeller f6708d194c Expose all public user class methods (including inherited methods) for reflection
Also removes declared constructors hint for user classes which should not be necessary.

See gh-29335
2022-10-20 09:32:55 +02:00
Juergen Hoeller 7f1990e64e Merge branch '5.3.x' 2022-10-19 16:27:03 +02:00
Juergen Hoeller 4c38777064 Explain logger name semantics (see AbstractTraceInterceptor.setLoggerName)
See gh-28678
2022-10-19 14:49:27 +02:00
Vedran Pavic fb291379e4 Avoid use of Commons Logging in LoggingCacheErrorHandler public API
At present, creating LoggingCacheErrorHandler with custom logger requires use of Commons Logging API, as the appropriate constructor expects org.apache.commons.logging.Log instance. As Commons Logging is rarely the logging framework of choice in applications these days, interaction with its API might not be desirable.

This commit adds LoggingCacheErrorHandler constructor that accepts logger name and thus avoids leaking out any details about the underlying logging framework.
2022-10-19 13:48:59 +02:00
Juergen Hoeller 6b6cf1b4a2 Avoid decorated definition bypass for scoped proxy determination
GenericApplicationContext registers proxy hints without any SmartInstantiationAwareBeanPostProcessor involved as well.

Closes gh-29335
2022-10-19 09:55:47 +02:00
Stephane Nicoll 82a0154bd1 Expose a system property when AOT processing is running
This commit exposes a "spring.aot.processing" system property when the
AOT engine is running. This can be used by code that need to react
differently when the application is being refreshed for AOT processing.

Closes gh-29340
2022-10-18 18:18:43 +02:00
Sam Brannen eadb003a8d Introduce builder API for AOT processor Settings
Closes gh-29341
2022-10-18 16:33:16 +02:00
Juergen Hoeller cb44e09694 Merge branch '5.3.x' 2022-10-18 16:24:35 +02:00
Juergen Hoeller 8e25e32eb8 Polishing 2022-10-18 16:17:30 +02:00
Juergen Hoeller f4dfe94702 Fallback to ISO-based default java.time type parsing
Closes gh-26985
2022-10-18 12:49:14 +02:00
Sam Brannen 4d44aaf81b Omit deprecation warning for Bean Validation constraint annotations
Prior to this commit, AnnotationTypeMapping logged a warning for the use
of convention-based annotation attribute overrides in composed Bean
Validation constraint annotations, even though those attribute overrides
are not related to Spring.

For example, Hibernate's @URL constraint annotation is meta-annotated
with Bean Validation's @Pattern constraint annotation, and we should not
log a warning in such scenarios.

This commit addresses that by not logging a warning if convention-based
annotation attribute overrides are detected for a composed @Constraint
annotation.

Closes gh-29206
2022-10-17 19:39:02 +02:00
Juergen Hoeller bba313c2f5 Perform basic property determination without java.beans.Introspector
Closes gh-29320
2022-10-13 19:02:45 +02:00
Juergen Hoeller bba66429fb Polishing 2022-10-11 15:35:25 +02:00
Sam Brannen f00e4b230f Support method chaining in AbstractAotProcessor.Settings
See gh-29266
2022-10-10 19:09:41 +02:00
Sam Brannen 7ed42ca4ca Polish ContextAotProcessor 2022-10-10 18:58:27 +02:00
Sam Brannen cad7444afa Introduce Settings container in AbstractAotProcessor
See gh-29266
2022-10-10 18:58:27 +02:00
Stephane Nicoll 4eca87baa3 Handle hints for CGLIB proxies consistently
This commit makes sure that hints are registered for CGLIB proxies even
if the proxy itself is not created. This typically happens when AOT runs
on an existing classpath, and a previous run already created the proxy.

Closes gh-29295
2022-10-10 17:39:26 +02:00
Stephane Nicoll e8ce86a6f0 Relocate testfixtures 2022-10-10 17:36:11 +02:00
Sam Brannen de609e5d45 Polishing 2022-10-10 16:52:22 +02:00
Sam Brannen b2b3163fae Redesign AOT processors for consistency and simplification
There's currently a considerable amount of overlap between the
implementations of AotProcessor and TestAotProcessor. In addition
AotProcessor is abstract and does not include a main() method; whereas,
TestAotProcessor is concrete and does include a main() method.

To address these issues, this commit:

- Introduces an AbstractAotProcessor base class that AotProcessor and
  TestAotProcessor now both extend

- Moves common properties/functionality to AbstractAotProcessor

- Renames AotProcessor to ContextAotProcessor

- Makes TestAotProcessor abstract like ContextAotProcessor

- Removes the main() method from TestAotProcessor

Closes gh-29266
2022-10-10 16:27:04 +02:00
Sébastien Deleuze 42c3ac64ff Remove spring.spel.ignore and spring.xml.ignore flags
This commit also removes ResourcePropertiesPersister which
was introduced in 5.3 specifically for spring.xml.ignore
flag and which is expected to be used only internally by
Spring Framework. DefaultPropertiesPersister should be used
instead.

Closes gh-29277
2022-10-10 12:11:19 +02:00
Sam Brannen c98ed17728 Polishing 2022-10-08 13:43:09 +02:00
Johnny Lim ced37d53b4 Polishing
Closes gh-29284
2022-10-08 13:43:09 +02:00
Sam Brannen 72307bbb20 Polish contribution
See gh-28549
2022-10-07 16:35:55 +02:00
hebo 2434470457 Optimize SpEL and property placeholder support for @Async qualifiers
See gh-27818
Closes gh-28549
2022-10-07 16:22:18 +02:00
Juergen Hoeller b45a48461f Polishing 2022-10-06 12:03:25 +02:00
Juergen Hoeller 3af0c232b7 ProxyFactoryBean determines actual proxy class in getObjectType()
AopProxy implementations accept empty Advisor chains for early proxy class creation.

Closes gh-29097
2022-10-06 11:54:06 +02:00
Stephane Nicoll efaee61f31 Harmonize accessors of RuntimeHints API
Closes gh-29269
2022-10-06 09:36:17 +02:00
Sam Brannen 05d6c4c9b2 Polishing 2022-10-05 20:02:44 +02:00
Stephane Nicoll 2f20d6322b Enable cglib proxy for configuration classes if necessary
This commit updates code generation to customize the instantiation of
a configuration class that requires a proxy. Rather than instantiating
the raw class, the proxy is used.

Closes gh-29107
2022-10-04 16:54:44 +02:00
Sam Brannen 5bff2c7341 Clean up warnings in tests 2022-10-04 16:19:37 +02:00
Brian Clozel 31a84fb38e Temporarily ignore tests until gh-29246 is re-applied
See gh-29246
2022-10-03 14:29:45 +02:00
Juergen Hoeller d873f60fef Enforce early initialization of CGLIB method proxies (for AOT processing)
For non-required method proxies, prefer regular reflective invocation instead.

See gh-29107
2022-10-03 13:22:49 +02:00
Stephane Nicoll 0cc3c6b5d1 Add entry point for processing an application ahead-of-time
This commit adds the necessary infrastructure to process an application
using the AOT engine, similar to the existing TestAotProcessor for
processing tests.

This can be used by frameworks built on top of Spring Framework, for
instance by providing a main method that can be triggered by build
tools.

Close gh-29181
2022-09-30 16:18:27 +02:00
Sébastien Deleuze 7a2110d8a5 Refine Kotlin bean DSL for AOT use case
Before this commit, beans registered with the Kotlin bean DSL
typically added via SpringApplication#addInitializers
were registered 2 times: by the code generated AOT and by
the listener executed at runtime.

After this commit, such beans are only registered 1 time when
AOT generation is involved, and does not require specific
reflection hints on native execution anymore.

Closes gh-29211
2022-09-30 12:25:43 +02:00
Stephane Nicoll e4940149d9 Polish "Replace AotApplicationContextInitializer with interface"
Closes gh-29157
2022-09-30 07:46:00 +02:00
Phillip Webb f2568f2dda Remove unused import
See gh-29157
2022-09-29 16:50:15 -07:00
Phillip Webb 86ad29a7d6 Drop getAotInitializers method
See gh-29157
2022-09-29 15:43:13 -07:00
Phillip Webb 192bc1eb13 Fix factory method return type
See gh-29157
2022-09-29 15:38:37 -07:00
Phillip Webb ac13d26077 Replace AotApplicationContextInitializer with interface
Replace the `ApplicationContextAotInitializer` class with an
`AotApplicationContextInitializer` interface so that its use can be
detected using a simple `instanceof` check. The existing functionality
has been moved to a factory method on the interface allowing:

	`new ApplicationContextAotInitializer()
		.initialize(context, names);`

To now be written as:

	`AotApplicationContextInitializer.forInitializerClasses(names)
		.initialize(context);`

See gh-29157
2022-09-29 14:43:25 -07:00
rstoyanchev 9eaae0fe04 Polishing contribution and Theme deprecation notices
Closes gh-28870
2022-09-28 16:22:45 +01:00
Adam Ostrožlík 0ccb64fe10 Replace Collectors.toList with Stream.toList
Closes gh-29203
2022-09-26 18:32:01 +02:00
Sam Brannen 6affae4120 Polish resourceArrayPropertyEditor() test 2022-09-25 19:31:06 +02:00
Stephane Nicoll 4625e92eb8 Break dependency between TestCompiler and AOT
This commit improves `TestCompiler` with a `with` function that allows
to customize a test compiler instance. Rather than `TestCompiler`
knowing about `TestGenerationContext`, the latter implements the
function so that it can be passed as is.

See gh-29175
2022-09-20 15:07:51 +02:00
Sam Brannen 321092ce6f Consistent use of @Deprecated(since = "6.0") 2022-09-20 14:34:24 +02:00
Phillip Webb 52bffbff76 Move `TestCompiler` and related classes to `core.test.tools` package
Closes gh-29175
2022-09-19 22:29:40 -07:00
Sam Brannen b87d48b99b Merge branch '5.3.x' 2022-09-14 17:18:00 +02:00
Marc Wrobel ce49068ff9 Fix links in Javadoc and reference docs
- Fix broken links (by using a new URL, an alternative URL, or a
  Wayback Machine link)

- Use HTTPS where possible

- Remove https://issuetracker.springsource.com/browse/EBR-349: this
  link is dead and is also mentioned in
  https://jira.spring.io/browse/SPR-8093

- Clean up nohttp allowlist.lines

Closes gh-28876
2022-09-14 17:00:11 +02:00
Sam Brannen 992a81ab68 Merge branch '5.3.x'
# Conflicts:
#	spring-web/src/main/java/org/springframework/web/util/WebUtils.java
2022-09-14 16:12:04 +02:00
Sam Brannen 50dff77d01 Polish contribution 2022-09-14 16:08:01 +02:00
Marc Wrobel 0f479293b1 Replace use of the <tt> HTML tag in Javadoc
The <tt> HTML tag was used in HTML 4 to define teletype text. It is not
supported in HTML5, and its use is discouraged.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tt

Closes gh-28819
2022-09-14 15:56:16 +02:00
Sam Brannen 911d1f2dea Suppress warnings 2022-09-14 15:27:11 +02:00
Stephane Nicoll 6cfbf391ec Merge branch '5.3.x' 2022-09-13 08:42:56 +02:00
Stephane Nicoll 0d2bfc926f Apply consistent ordering in hierarchical contexts
Previously, if `@Order` is specified on a `@Bean` method, and the
candidate bean is defined in a parent context, its order wasn't taken
into account when retrieving the bean from a child context.

This commit makes sure the metadata of a bean is taken into
consideration in all cases.

Closes gh-29105
2022-09-13 07:23:22 +02:00
Stephane Nicoll 0dba729823 Polish "Allow MethodReference to support a more flexible signature"
See gh-29005
2022-09-12 16:25:10 +02:00
Brian Clozel 0770d86936 Deprecate StreamUtils.emptyInput()
Closes gh-29125
2022-09-12 10:21:50 +02:00
Stephane Nicoll 7642ac82f6 Apply @PropertySource in AOT-generated context
This commit records `@PropertySource` declarations defined on
configuration classes so that these are contributed to the environment
of a context that is initialized by generated code.

Closes gh-28976
2022-09-12 10:09:37 +02:00
Stephane Nicoll 2b45fd4388 Allow bean factory initialization to have a more flexible signature
This commit allows bean factory initialization to use a more flexible
signature than just consuming the DefaultListableBeanFactory. The
environment and the resource loader can now be specified if necessary.

See gh-29005
2022-09-12 10:07:35 +02:00
Stephane Nicoll ae706f3954 Allow MethodReference to define a more flexible signature
This commit moves MethodReference to an interface with a default
implementation that relies on a MethodSpec. Such an arrangement avoid
the need of specifying attributes of the method such as whether it is
static or not.

The resolution of the invocation block now takes an
ArgumentCodeGenerator rather than the raw arguments. Doing so gives
the opportunity to create more flexible signatures.

See gh-29005
2022-09-12 10:07:31 +02:00
Stephane Nicoll 8a4a89b9d9 Allow a MethodReference to be produced from a GeneratedMethod
This commit updates GeneratedMethod and its underlying infrastructure
to be able to produce a MethodReference. This simplifies the need when
such a reference needs to be created manually and reuses more of what
MethodReference has to offer.

See gh-29005
2022-09-12 10:07:13 +02:00
Nheyll 058109315d Deprecate support for theme
As seen in gh-28868, the support for Themes is now deprecated as of
Spring Framework 6.0 and will be removed in a future release.

Closes gh-29114
2022-09-09 11:22:21 +02:00
Sam Brannen 1688becd73 Avoid questionable use of ClassPathResource#getPath() in tests
Prior to this commit, several tests used ClassPathResource#getPath()
based on the knowledge that the ClassPathResource had been created
using the ClassPathResource(String,Class) constructor. However, making
such an assumption seems ill advised in light of the abstraction that
ClassPathResource provides.

In light of that, this commit avoids questionable use of
ClassPathResource#getPath() in tests by refactoring those tests to use
the proper abstractions provided by ClassPathResource.
2022-09-07 14:59:05 +02:00
Stephane Nicoll 1e8017107a Remove unnecessary workaround
See gh-29091
2022-09-07 07:50:49 +02:00
Sam Brannen dc07ca1d36 Polish AsyncExecutionTests 2022-09-06 12:53:31 +02:00
Stephane Nicoll 6e93f1187c Move TestCompiler from generator to generate
This commit harmonizes the package space by moving the TestCompiler
infrastructure from the now outdated "generator" package to "generate".

Closes gh-29082
2022-09-05 16:30:19 +02:00
Stephane Nicoll 58b0251af1 Relocate TestGenerationContext to spring-core-test
This commit moves the test implementation for GenerationContext in
spring-core-test. This also removes the copy we had in testfixtures

See gh-28877
2022-09-05 16:21:17 +02:00
Stephane Nicoll 16ff05ed86 Polish 2022-09-05 11:55:19 +02:00
Sébastien Deleuze aaffb8b27e Move BindingReflectionHintsRegistrar to spring-core
See gh-28979
2022-09-02 17:31:43 +02:00
Sam Brannen 6475523a53 Merge branch '5.3.x' 2022-09-02 16:42:07 +02:00
Sam Brannen 0389fcca7e Fix sporadically failing SpEL test 2022-09-02 16:41:44 +02:00
Phillip Webb 505da5c602 Migrate hint registration to shortcuts
Migrate code to make use of the `MemberCategory` and `FieldMode`
shortcuts.

See gh-29011
2022-09-01 17:26:06 -07:00
Stephane Nicoll 5aa8583159 Add shortcut to register an executable with a mode
See gh-29011
2022-08-24 19:32:02 +02:00
Stephane Nicoll c164b918c0 Apply consistent RuntimeHints defaults
This commit harmonizes the registration of an executable so that
the default method and the method that takes an empty customizer
produces the same hint. The same applies to the readable flag of
a field hint.

Rather than returning a list of executable modes, the "highest" mode
is retained.

See gh-29011
2022-08-24 19:32:01 +02:00
Stephane Nicoll c6bcf79c0e Add hint for use of Qualifier in meta-annotations
Closes gh-29000
2022-08-23 14:31:09 +02:00
Stephane Nicoll 455715899d Infer proxy on `@Lazy`-annotated injection points
This commit makes use of the new `getLazyResolutionProxyClass` on
`AutowireCandidateResolver` to detect if a injection point requires
a proxy.

Closes gh-28980
2022-08-22 20:48:02 +02:00
Stephane Nicoll 40de029bf8 Polish 2022-08-22 16:32:53 +02:00
Juergen Hoeller 4eb84a0537 Introduce getLazyResolutionProxyClass mechanism in AutowireCandidateResolver SPI
See gh-28980
2022-08-22 16:24:37 +02:00
Stephane Nicoll 8a51e31069 Make sure that AnnotationAwareOrderComparator is configured with AOT
Closes gh-28988
2022-08-22 14:18:42 +02:00
Juergen Hoeller 9b2a40a3bc Lazy Validator resolution in MethodValidationPostProcessor
Closes gh-28990
2022-08-22 14:07:42 +02:00
Sébastien Deleuze daf2d940e4 Remove specific JDK dynamic proxy configuration
Further refinements will be required for
MethodValidationPostProcessor since @Lazy
used by Spring Boot is not supported yet
for that use case.

See gh-28980
2022-08-22 10:53:12 +02:00
Sébastien Deleuze ebf6de8f5d Infer JDK dynamic proxies for Spring beans
See gh-28980
2022-08-22 07:58:15 +02:00
Juergen Hoeller 427e5f5899 Final merged bean definition clearing in freezeConfiguration
Instead of individual last-minute clearing in markBeanAsCreated, the factory clears all merged bean definitions in freezeConfiguration, retaining the changes of merged bean definition post-processing after that point (in particular in refreshForAotProcessing).

Closes gh-28948
2022-08-19 17:30:59 +02:00
Stephane Nicoll 4556895e6e Expose registrar for @Reflective
This commit exposes the logic of processing `@Reflective` on beans so
that it can be reused in custom arrangements.

Closes gh-28975
2022-08-17 14:33:09 +02:00
Sébastien Deleuze 06d9db154e Introduce CachingBeanRegistrationAotProcessor
It contributes proxy hints for interfaces when class
proxying is not forced.

Closes gh-28943
2022-08-17 11:38:12 +02:00
Sébastien Deleuze 491b7771d0 Register proper caching annotation runtime hints
See gh-28943
2022-08-17 11:36:24 +02:00
Stephane Nicoll 4f0c879778 Rationalize hints required for annotations
This commit updates RuntimeHintsUtils to focus on registering a JDK
proxy only as annotations of annotated elements that have at least
an introspection hints are visible out-of-the-box.

This commit also removes unnecessary hints and adapt `@Reflective` to
detect if a hint is required using the introduced
MergedAnnotation#isSynthesizable.

See gh-28967
2022-08-16 15:42:52 +02:00
Stephane Nicoll 9a1b7c5e47 Allow target type of a cglib proxy to be visible
This commit updates the hints of a Cglib proxy's target type so that
methods can be invoked and constructors can be introspected. The former
is needed as a cglib proxy invokes the target type via reflection. As
for that latter, this is required at least by
Enhancer#filterConstructors.

See gh-28954
2022-08-16 08:30:37 +02:00
Stephane Nicoll 6ba31acf35 Polish "Add support for Async invocation in a native image"
This registers the hints if the annotation post processor is active,
rather than statically.

See gh-28710
2022-08-12 17:43:48 +02:00
Stephane Nicoll 0229cc45a0 Add support for Async invocation in a native image
This commit adds necessary hints so that Async-annotated method can be
discovered in a native image.

Closes gh-28710
2022-08-12 16:34:13 +02:00
Stephane Nicoll 3086d90e7d Add the necessary hints for use of Cglib proxies
This commit expands GeneratedClassHandler to allow invocation of
declared fields and methods. Generated proxies have a number of
internal fields and methods that are invoked via reflection.

See gh-28954
2022-08-12 16:27:10 +02:00
Stephane Nicoll 7c2453c373 Integrate class proxy generation in AOT processing
This commit updates ApplicationContextAotGenerator to register a
handler that process Cglib generated classes. The handler registers
such classes to the GeneratedFiles and provide a hint so that it
can be instantiated using reflection.

Closes gh-28954
2022-08-12 12:17:13 +02:00
Juergen Hoeller 38c9e7f629 Polishing 2022-08-10 23:30:27 +02:00
Juergen Hoeller b31a15851e Support for pre-generated CGLIB proxy classes (in AOT scenarios)
Includes runtime storing of generated classes to a directory specified by the "cglib.generatedClasses" system property. Avoids lazy CGLIB fast-class generation and replaces generated Enhancer and MethodWrapper key classes with equivalent record types. Introduces support for early type determination in InstantiationStrategy, AopProxy and SmartInstantiationAwareBeanPostProcessor - in order to trigger CGLIB class generation in refreshForAotProcessing (through early determineBeanType calls for bean definitions).

Closes gh-28115
2022-08-10 23:30:19 +02:00
Stephane Nicoll 005713066c Freeze configuration before invoking MBDPP instances
This commit updates refresh for AOT processing so that the configuration
is frozen before invoking MergedBeanDefinitionPostProcessor instances.
This makes sure that post-processed MergedBeanDefinitions are kept in
cache and not lost if a component attempts to clear the metadata cache.

Closes gh-28941
2022-08-09 13:29:14 +02:00
Sam Brannen 1e8bc1b0fb Polishing 2022-08-06 14:42:19 +03:00
Sam Brannen 7d364bba72 Clean up warnings 2022-08-06 14:41:54 +03:00
Sam Brannen 1de0207874 Rename tests due to change in gh-28927 2022-08-05 13:59:14 +03:00
Sam Brannen 853407b6f8 Polishing 2022-08-05 13:57:28 +03:00
Stephane Nicoll 2cc4486e3d Rename ApplicationContextAotGenerator entry point
Closes gh-28927
2022-08-05 10:19:06 +02:00
Stephane Nicoll 6685e78c36 Deprecate NestedIOException
NestedIOException has been removed in Spring Framework 6 and this commit
marks it as deprecated in 5.x. Users that were relying on this exception
should use IOException directly.

Closes gh-28929
2022-08-05 10:04:47 +02:00
Stephane Nicoll e50db8c8c5 Make sure that ImportAwareAotBeanPostProcessor has role infrastructure
See gh-28915
2022-08-04 09:37:17 +02:00
Stephane Nicoll 332d4a4c9c Apply same order than original BPP
This commit updates ImportAwareAotBeanPostProcessor to be priority
ordered, with the same order as its original BeanPostProcessor. This
makes sure that infrastructure beans can be post-processed if
necessary

See gh-28915
2022-08-04 09:35:11 +02:00
Stephane Nicoll e5f9574800 Fix test
Contribution was not applied on the actual use case

See gh-28915
2022-08-04 09:32:45 +02:00
Stephane Nicoll 3a890033b7 Fix custom bean definition to stop using reflection
See gh-28915
2022-08-03 14:51:52 +02:00
Stephane Nicoll 1fdd91eb30 Restore order of setImportMetadata in AOT optimized contexts
This commit adapts the generated code for handling ImportAware to
register a bean definition rather than adding the BeanPostProcessor
directly on the beanFactory. The previous arrangement put the
post processor handling import aware callbacks first on the list,
leading to inconsistent callback orders.

Tests have been adapted to validate this exact scenario.

Closes gh-28915
2022-08-03 10:16:20 +02:00
Sam Brannen b0ab0edd9d Polishing 2022-08-02 13:07:12 +03:00
Sam Brannen e4395f2f8b Clean up warnings and polishing 2022-07-31 14:14:56 +03:00
Sam Brannen ad99add429 Polish AOT support 2022-07-30 10:51:14 +03:00
Stephane Nicoll 11d790c6eb Merge branch '5.3.x' 2022-07-29 18:07:37 +02:00
Stephane Nicoll 04209def46 Polish "Improve documentation of Cacheable"
Apply the same improvements to CacheEvict and CachePut.

See gh-28183
2022-07-29 18:04:23 +02:00
luvarqpp 3a61930bd0 Improve documentation of Cacheable
See gh-28183
2022-07-29 17:57:15 +02:00
Phillip Webb d33c2b52cc Don't look for RuntimeHintsRegistrar beans
Update `RuntimeHintsBeanFactoryInitializationAotProcessor` so
that `RuntimeHintsRegistrar` beans are not loaded.

See gh-28866
2022-07-27 19:26:12 +01:00
Phillip Webb 472c23455a Add AotServices class to replace AotFactoriesLoader
Add an `AotServices` class to replace `AotFactoriesLoader`. The
replacement class allow instances to be loaded from just the
`aot.factories` file if required. It also retains a link to the bean
names so that a `findByBeanName(...)` method can be provided.

See gh-28833
2022-07-27 19:25:28 +01:00
Arjen Poutsma 2aa74c9121 Deprecate ListenableFuture in favor of CompletableFuture
This commit deprecates ListenableFuture in favor of CompletableFuture.
ListenableFuture was introduced in Spring Framework 4.0, when
CompletableFuture was not yet available. Spring now requires JDK 17, so
having our own type no longer seems necessary.

Major changes in this commit include:
- Deprecation of ListenableFuture and related types
  (ListenableFutureCallback, SettableListenableFuture, etc.)
- Deprecation of AsyncListenableTaskExecutor in favor of default methods
  in AsyncTaskExecutor (submitCompletable).
- AsyncHandlerMethodReturnValueHandler now has toCompletableFuture
  instead of toListenableFuture.
- WebSocketClient now has execute methods, which do the same as
  doHandshake, but return CompletableFutures (cf. the reactive
  WebSocketClient).

All other changes
- add an overloaded method that takes a CompletableFuture parameter
  instead of ListenableFuture, and/or
- add a method with a 'Async' suffix that returns a CompletableFuture
  instead of a ListenableFuture (connectAsync, sendAsync).

Closes gh-27780
2022-07-27 12:41:35 +02:00
Stephane Nicoll 3d5003ad63 Introduce TestGenerationContext
This commit polishes DefaultGenerationContext to make the method
that flushes generated classes more explicit. It now throws an
IOException and TestGenerationContext has been updated to handle
that to ease its use in code that can't throw such an exception.

As this use case is likely to happen outside the Spring Framework,
this commit adds such a convenience to spring-test as well.

Closes gh-28877
2022-07-26 17:56:17 +02:00
Stephane Nicoll ebe3b37298 Allow MergedBeanDefinitionPostProcessor to handle bean creation
This commit registers the MergedBeanDefinitionPostProcessor instances
on the BeanFactory processed for AOT purposes. This allows beans that
are created at build-time to be post-processed for low-level needs such
as initialization and autowiring.

Closes gh-28777
2022-07-26 09:25:11 +02:00
Phillip Webb f2d31b7a20 Migrate AOT tests to use GeneratedClasses and refine/polish AOT APIs
Migrate all AOT tests to make use of `GeneratedClasses` rather than
directly generating Java files. This commit also refines and polishes
AOT APIs to being greater consistency.

Specifically:

	- The `MethodGenerator` interface has been removed in favor of
	  working directly with `GeneratedMethods`.
	- The visibility of several constructors and methods has been
	  reduced to package-private.
	- The `using(...)` and `builder` methods have been removed in
	  favor of setting the `Consumer` callbacks directly as
	  constructor arguments.
	- Variable names for builders are now named `type` or `method`
	  depending on what they're building.

Closes gh-28831
2022-07-18 08:40:59 +01:00
Sam Brannen 0fb9de5d0e Merge branch '5.3.x' 2022-07-13 16:36:01 +02:00
Marc Wrobel bd3499671c Fix typos in test code
This commit fixes typos in test class names, test method names, and
test variable names.

Closes gh-28807
2022-07-13 16:24:11 +02:00
Sam Brannen aae9050351 Merge branch '5.3.x'
# Conflicts:
#	spring-context/src/main/java/org/springframework/scheduling/annotation/Async.java
#	spring-context/src/testFixtures/java/org/springframework/context/testfixture/jndi/SimpleNamingContextBuilder.java
#	spring-core/src/main/java/org/springframework/core/BridgeMethodResolver.java
#	spring-core/src/main/java/org/springframework/util/MimeType.java
2022-07-13 14:55:30 +02:00
Marc Wrobel c48c5e7691 Fix and improve Javadoc in spring-context
Closes gh-28802
2022-07-13 14:45:23 +02:00
Stephane Nicoll 2c92d7da8f Harmonize RuntimeHintsRegistrar implementations
Closes gh-28801
2022-07-12 18:30:23 +02:00
Stephane Nicoll 54a3f66d1d Move RuntimeHints predicate support to a dedicated package
This commit moves `RuntimeHintsPredicate` and its support classes that
form a cohesive concept in a dedicated `.predicate` package.

Closes gh-28799
2022-07-12 16:16:12 +02:00
Sam Brannen 65f9106d49 Polishing 2022-07-11 18:53:29 +02:00
Sam Brannen dad67423d6 Suppress warnings 2022-07-11 18:53:11 +02:00
Sam Brannen 5178e9c28e Simplify hint registration for Spring AOP proxies
Prior to this commit, when users wished to register proxy hints for a
Spring AOP JDK dynamic proxy, they were required to explicitly specify
SpringProxy, Advised, and DecoratingProxy along with user interfaces.

This commit simplifies hint registration for Spring AOP proxies by
introducing two completeJdkProxyInterfaces() methods in AopProxyUtils,
one that accepts strings and one that accepts classes that represent
the user-specified interfaces implemented the user component to be
proxied. The SpringProxy, Advised, and DecoratingProxy interfaces are
appended to the user-specified interfaces and returned as the complete
set of interfaces that the proxy will implement.

Closes gh-28745
2022-07-10 20:10:12 +02:00
Sam Brannen 2af08cf163 Merge branch '5.3.x'
# Conflicts:
#	spring-core/src/test/java/org/springframework/core/annotation/TypeMappedAnnotationTests.java
#	spring-test/src/test/java/org/springframework/test/context/junit4/TimedSpringRunnerTests.java
#	spring-test/src/test/java/org/springframework/test/util/MetaAnnotationUtilsTests.java
#	spring-test/src/test/java/org/springframework/test/util/OverriddenMetaAnnotationAttributesTests.java
2022-07-09 16:24:04 +02:00
Sam Brannen d274e893a6 Remove superfluous static declaration for enum, annotation, & interface 2022-07-09 16:16:13 +02:00
Sam Brannen 73d92d66b9 Stop using convention-based annotation attribute overrides in tests
This commit replaces convention-based annotation attribute overrides in
tests with explicit use of @AliasFor -- except for tests in spring-core,
since we still want to test our support for convention-based annotation
attribute overrides.

See gh-28760
2022-07-08 19:28:14 +02:00
Arjen Poutsma 9b739a2310 Update scheduling package to use java.time
This commit deprecates all methods in org.springframework.scheduling
that use

- Date, in favor of variants that take an Instant.
- long & TimeUnit, in favor of variants that take a Duration.

Closes: gh-28714
2022-07-08 16:25:27 +02:00
Sébastien Deleuze fd265a18c6 Add runtime hints for scheduling support
Closes gh-28696
2022-07-04 14:18:27 +02:00
Sam Brannen ce5076ffe8 Merge branch '5.3.x' 2022-07-03 18:05:36 +02:00
Sam Brannen d1d6eb095e Fix GenericApplicationContextTests on Microsoft Windows (round 2)
The previous change to the tests resulted in a failure on Windows when
using the DefaultResourceLoader by expecting an exception when no
exception is thrown.

This commit narrows the scope of the if-clause to expect an exception
only when using the FileSystemResourceLoader on Windows.

See gh-28703, gh-28746
2022-07-03 17:59:37 +02:00
Sam Brannen 94e3738a94 Merge branch '5.3.x'
# Conflicts:
#	spring-context/src/test/java/org/springframework/context/support/GenericApplicationContextTests.java
2022-07-03 14:51:37 +02:00
Sam Brannen e608b36713 Improve GenericApplicationContextTests.getResource*() tests
This commit updates the tests so that they test something meaningful on
MS Windows as well as on Linux/Mac.

See gh-28703, gh-28746
2022-07-03 14:36:41 +02:00
jason 59180e76a7 Fix GenericApplicationContextTests on Microsoft Windows
The tests introduced in commit 9868c28c73 pass on Mac OS and Linux but
fail on Microsoft Windows.

This commit updates the tests so that they pass on MS Windows as well.

See gh-28703
Closes gh-28746
2022-07-03 14:35:07 +02:00
Sam Brannen b2998842af Merge branch '5.3.x' 2022-07-02 17:09:29 +02:00
Sam Brannen c5987d7c37 Fix typo in test 2022-07-02 17:09:07 +02:00
Sébastien Deleuze 8c063a0e2a Add runtime hints for MethodValidationPostProcessor
Closes gh-28689
2022-07-01 10:18:08 +02:00
Brian Clozel 772d801e48 Test the ApplicationContextAotGenerator with the agent
This commit adds new tests for the `ApplicationContextAotGenerator`,
this time leveraging the `RuntimeHintsAgent` that checks the need for
runtime hints at runtime.

See gh-27981
2022-06-30 18:20:32 +02:00
Sébastien Deleuze 9135921d1d Move BindingReflectionHintsRegistrar to spring-context
Closes gh-28735
2022-06-30 11:56:08 +02:00
Sam Brannen af16e49334 Merge branch '5.3.x'
# Conflicts:
#	spring-context/src/main/java/org/springframework/context/support/GenericApplicationContext.java
#	spring-context/src/test/java/org/springframework/context/support/GenericApplicationContextTests.java
2022-06-27 18:14:00 +02:00
Sam Brannen 9868c28c73 Honor ProtocolResolvers in GenericApplicationContext
When the ProtocolResolver SPI was introduced in Spring Framework 4.3,
support for protocol resolvers was added in DefaultResourceLoader's
getResource() implementation; however, GenericApplicationContext's
overridden getResource() implementation was not updated accordingly.

Prior to this commit, if a GenericApplicationContext was configured
with a custom ResourceLoader, registered protocol resolvers were
ignored.

This commit ensures that protocol resolvers are honored in
GenericApplicationContext even if a custom ResourceLoader is used.

Closes gh-28703
2022-06-27 18:00:29 +02:00
Sam Brannen a970516080 Polish GenericApplicationContextTests 2022-06-27 17:05:02 +02:00
Sam Brannen 5e5e95aff7 Polish RuntimeHintsUtils 2022-06-27 16:29:34 +02:00
Stephane Nicoll 6199835d6e Harmonize generated class name conventions
This commit moves the responsibility of naming classes to the
GenerationContext. This was already largely the case before, except that
the concept of a "mainTarget" and "featureNamePrefix" was specific
to bean factory initialization contributors.

ClassNameGenerator should now be instantiated with a default target
and an optional feature name prefix. As a result, it does no longer
generate class names in the "__" package.

GeneratedClasses can now provide a new, unique, GeneratedClass or
offer a container for retrieving the same GeneratedClass based on an
identifier. This lets all contributors use this facility rather than
creating JavaFile manually. This also means that ClassNameGenerator
is no longer exposed.

Because the naming conventions are now part of the GenerationContext, it
is required to be able to retrieve a specialized version of it if a
code generation round needs to use different naming conventions. A new
withName method has been added to that effect.

Closes gh-28585
2022-06-23 16:05:23 +02:00
Sam Brannen a3d3667e64 Merge branch '5.3.x' 2022-06-21 16:19:21 +02:00
Sam Brannen 26df4580b3 Revise internals of LoggingCacheErrorHandler
Since LoggingCacheErrorHandler was only recently introduced in 5.3.16,
we have decided to completely revise its internals (protected API) in
5.3.x while retaining the current public API.

Specifically, this commit:

- introduces protected getLogger() and isLogStackTraces() methods to
  improve extensibility

- revises logCacheError() to accept a Supplier<String> for lazy
  resolution of error messages

Closes gh-28672
See gh-28670, gh-28648
2022-06-21 16:13:55 +02:00
Sam Brannen 6152e41249 Merge branch '5.3.x' 2022-06-21 14:41:24 +02:00
Vedran Pavic 57208bf47a Simplify LoggingCacheErrorHandlerTests
See gh-28648
2022-06-21 14:40:09 +02:00
Sam Brannen 22bfd5a7b6 Merge branch '5.3.x' 2022-06-21 14:14:53 +02:00
Sam Brannen 8b34558284 Polish LoggingCacheErrorHandler 2022-06-21 14:07:39 +02:00
Vedran Pavic dbe8f200a9 Simplify creation of LoggingCacheErrorHandler with logged stacktrace
At present, creating a LoggingCacheErrorHandler that logs stack traces
also requires supplying the logger to be used. This might be
inconvenient for some users, as it requires usage of the Commons
Logging API.

This commit simplifies creation of such as LoggingCacheErrorHandler
instance by adding a constructor that only accepts a boolean flag
indicating whether to log stack traces.

Closes gh-28670
2022-06-21 13:50:10 +02:00
Stephane Nicoll 90759fb38f Relocate duplicated mock implementations to test fixtures
Closes gh-28659
2022-06-20 08:55:52 +02:00
Johnny Lim 5ae3902d71 Guard logging in RuntimeHintsBeanFactoryInitializationAotProcessor
See gh-28658
2022-06-20 07:58:47 +02:00
Juergen Hoeller a14650e0dc findAnnotationOnBean only falls back to bean class in case of no factory method
Most importantly, static @Bean methods do not expose their @Configuration class-level annotations anymore, aligned with the behavior for non-static @Bean methods.

Closes gh-28298
2022-06-14 14:01:38 +02:00
Juergen Hoeller 4e1b9f1492 Replace deep exception message nesting with custom inclusion of cause messages
Includes deprecation of NestedServletException, whereas NestedCheckedException and NestedRuntimeException remain as base classes with several convenience methods.

Closes gh-25162
2022-06-14 14:00:28 +02:00
Sébastien Deleuze 12d756a252 Refine ReflectiveProcessorBeanRegistrationAotProcessor
Add support for processing implemented interfaces and
remove Reflective from runtime hints.

See gh-28518
2022-06-13 14:54:57 +02:00
Brian Clozel 9c9b2356ce Add RuntimeHints predicates generator
The `RuntimeHints` API allows to describe hints for the reflection,
proxies and resources behavior at runtime. The need for a particular
behavior can be covered by several types of hints, at different levels.
This knowledge can be important in several cases:

* before contributing additional hints, infrastructure can check if an
  existing hint already covers the behavior
* this can be used in test suites and test infrastructure

This commit adds a new RuntimeHintsPredicates that generates `Predicate`
instances for testing `RuntimeHints` against a desired runtime behavior
for reflection, resources or proxies.

Closes gh-28555
2022-06-10 18:55:14 +02:00
Stephane Nicoll 363722893b Make sure RuntimeHintsRegistrar are invoked only once
Close gh-28594
2022-06-09 15:02:32 +02:00
Sam Brannen 282c3bc952 Merge branch '5.3.x' 2022-06-08 16:40:23 +02:00
Sam Brannen 8478e8e70a Polish contribution
This commit:

- fixes Checkstyle violations
- improves Javadoc
- adds missing @since tags
- renames getCurrentQueueSize() to getQueueSize()
- avoids NullPointerExceptions in getQueueSize()
- introduces tests for queue size and queue capacity

Closes gh-28583
2022-06-08 16:39:10 +02:00
Rémy e386bdb82c Expose ThreadPoolTaskExecutor queue size and capacity for metrics
We use Grafana to monitor our app via Spring's JMX exporter, and we
think it could be interesting to have at least the current queue size
for this purpose since the queue size directly affects the app memory
load. Having the queue capacity seems also interesting to set up
triggers whose values are calculated based on the maximum capacity of
the queue.

This commit introduces new getCurrentQueueSize() and getQueueCapacity()
methods in ThreadPoolTaskExecutor.

See gh-28583
2022-06-08 16:39:00 +02:00
Stephane Nicoll 571543285a Polish 2022-06-08 14:08:16 +02:00
Phillip Webb 172102d225 Refine ApplicationContextAotGenerator class name generation
Refine the class name logic so that the name is passed in rather
than using `ApplicationContext.getId()`. Also propagate the name
so that the generated classes use it.

See gh-28565
2022-06-04 12:26:00 -07:00
Phillip Webb 4bd33cb6e0 Allow ApplicationContextAotGenerator to generated better class names
Update `ApplicationContextAotGenerator` so that it can generate class
names based on a `target` class and using the ID of the application
context. Prior to this commit, the generated class name was always
`__.BeanFactoryRegistrations`.

Closes gh-28565
2022-06-03 18:15:37 -07:00
Sam Brannen 73acab7635 Merge branch '5.3.x'
# Conflicts:
#	spring-webmvc/src/main/java/org/springframework/web/servlet/support/RequestContextUtils.java
2022-06-03 13:35:22 +02:00
Sam Brannen aab9da0366 Polish LocaleResolver support 2022-06-03 13:10:55 +02:00
Stephane Nicoll baebf71ed7 Polish "Improve AssertJ usage in cache config tests"
See gh-28559
2022-06-03 10:33:01 +02:00
Andreas Grub 5ed0c848fe Improve AssertJ usage in cache config tests
See gh-28559
2022-06-03 10:15:36 +02:00
Stephane Nicoll da8c4de263 Add AotDetector to reliably opt-in for optimizations
This commit adds a central utility to figure out if the application
must run with Ahead-Of-Time optimizations. This is mandatory for running
in a native image but can be selected on the JVM using the
"spring.aot.enabled" property.

This commit also introduces a utility that can be used to initialize a
context with generated artifacts. This represents the runtime
counterpart of ApplicationContextAotGenerator.

Closes gh-28474
2022-06-02 14:52:11 +02:00
Brian Clozel 8af1496b37 Expand hints conditions support in RuntimeHints
Prior to this commit, the hints conditions were only supported for the
`TypeHint` case. GraalVM generally expanded this concept to all hints
and we should do the same.

Right now, only the `typeReachable` condition is available but we should
design for possible future additions.

This commit introduces a new `ConditionalHint` contract implemented by
all hints compatible with this approach. The condition information is
also used in all configuration writers as a result.

Closes gh-28126
2022-06-02 11:35:03 +02:00
Sam Brannen bc3b3d01ee Polishing 2022-06-01 14:57:16 +02:00
Sam Brannen 279f9647ab Merge branch '5.3.x' 2022-05-31 16:14:16 +02:00
Sam Brannen aa8802a81d Avoid new AssertJ deprecations 2022-05-31 16:13:31 +02:00
Sam Brannen ee209de9cf Merge branch '5.3.x'
# Conflicts:
#	spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java
#	spring-context/src/test/java/org/springframework/ejb/access/LocalSlsbInvokerInterceptorTests.java
#	spring-context/src/test/java/org/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptorTests.java
#	spring-web/src/test/java/org/springframework/remoting/jaxws/JaxWsSupportTests.java
#	spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/ViewResolutionIntegrationTests.java
2022-05-31 14:15:36 +02:00
Sam Brannen 1beb7068f6 Use new AssertJ exception assertions 2022-05-31 14:08:28 +02:00
Sam Brannen 720261db26 Use List.of() and Set.of() where feasible 2022-05-30 18:42:48 +02:00
Phillip Webb efa8ffb728 Polish 2022-05-26 20:56:06 -07:00
Stephane Nicoll 059b66bf26 Register annotation based on its type
This commit improves registerAnnotation to use the annotation type
rather than a `MergedAnnotation` attribute.

See gh-28497
2022-05-25 10:30:43 +02:00
Stephane Nicoll d0afbe40e6 Tag EventListener as a reflective operation
This commit adds compatibility of declarative event listeners in a
native image.

See gh-28475
2022-05-20 15:14:59 +02:00
Stephane Nicoll 4cca190aad Add support of declarative use of reflection
This commit adds a `@Reflective` annotation that can be used to declare
that the annotated element requires reflection at runtime. By default,
the annotated element is exposed but this can be customized by
specifying a dedicated `ReflectiveProcessor`.

Closes gh-28469
2022-05-20 15:02:46 +02:00
Stephane Nicoll 9487e8ce1e Polish 2022-05-18 13:57:48 +02:00
Sam Brannen 70415b1781 Merge branch '5.3.x' 2022-05-17 15:41:08 +02:00
Sam Brannen 59c7bb1f86 Use Arrays.toString instead of Arrays.asList when generating Strings 2022-05-17 15:36:31 +02:00
Sam Brannen 874077d16e Apply "advanced" instanceof pattern matching 2022-05-17 11:24:32 +02:00
Sam Brannen bf8a54decf Switch focus to JUnit Jupiter in testing examples 2022-05-16 10:05:37 +02:00
Sam Brannen 3d39dfc4ce Polishing 2022-05-14 18:35:58 +02:00
Sam Brannen 754636ee56 Merge branch '5.3.x' 2022-05-14 18:32:14 +02:00
Sam Brannen f2fe7f335c Improve nullReturningBeanPostProcessor() test
See gh-28459
2022-05-14 18:30:39 +02:00
evgeny.bovykin 7cb6ac0a02 Make inner classes static when feasible (on main)
A static nested class does not keep an implicit reference to its
enclosing instance.

This prevents a common cause of memory leaks and uses less memory per
instance of the class.

Closes gh-28433
2022-05-10 11:45:18 +02:00
Sam Brannen 5f8a4bcdc5 Merge branch '5.3.x'
# Conflicts:
#	spring-context/src/main/java/org/springframework/jmx/export/MBeanExporter.java
#	spring-context/src/main/java/org/springframework/scripting/support/StandardScriptFactory.java
2022-05-09 20:08:37 +02:00
Sam Brannen e26d8839b3 Stop referring to features as Java 6/7 features where unnecessary 2022-05-09 19:09:06 +02:00
Juergen Hoeller 2b65f274dc Use Set.of instead of HashSet with Arrays.asList 2022-05-06 16:19:27 +02:00
Juergen Hoeller f8c4071f73 Introduce removeApplicationListener method at ApplicationContext level
Closes gh-14023
2022-05-06 16:14:04 +02:00
Phillip Webb 16e7f1f212 Complete refactor of AOT concepts
Remove the AOT code that now has an alternative API.

Closes gh-28414
2022-05-05 13:34:52 -07:00
Phillip Webb 702207d9ee Add updated ApplicationContextAotGenerator
Add `ApplicationContextAotGenerator` implementation that makes
use of the new AOT generation APIs.

See gh-28414
2022-05-05 13:25:37 -07:00
Phillip Webb e4a8258fb2 Update ConfigurationClassPostProcessor AOT support
Update `ConfigurationClassPostProcessor` so that it provides AOT
contributions via the `BeanFactoryInitializationAotProcessor`
interface.

See gh-28414
2022-05-05 13:25:36 -07:00
Phillip Webb ddba45d01d Polish formatting 2022-05-05 12:35:21 -07:00
Juergen Hoeller 0f6d459de7 Support for jakarta.enterprise.concurrent.Asynchronous annotation
Closes gh-28400
2022-05-05 17:25:39 +02:00
Stephane Nicoll 7820804bf6 Allow registration of bean factory contributors via spring.factories
Closes gh-28342
2022-04-14 15:11:48 +02:00
Stephane Nicoll 8b97c2dc9d Polish 2022-04-14 14:56:08 +02:00
Brian Clozel 38019d2249 Allow static registration of RuntimeHints
Prior to this commit, we could only contribute `RuntimeHints` through
two mechanisms:
* `AotContributingBeanFactoryPostProcessor`, consdering the entire
  `BeanFactory` and designed for contributing both code and hints.
* `AotContributingBeanPostProcessor`, consdering beans one by one, but
  also designed for contributing both code and hints.

There are cases where libraries and applications want to contribute
`RuntimeHints` only, in a more static fashion: a dependency being
present, or a piece of infrastructure being considered by the
application context are good enough signals to contribute hints about
resources or reflection.

This commit adds the `RuntimeHintsRegistrar` contract for these cases.
Implementations can be declared as `spring.factories` and they will be
processed as soon as they're detected on the classpath. They can also be
declared with `@ImportRuntimeHints` and they will be processed if the
annotated bean definition is considered in the application context.
This annotation should be mainly used on configuration classes and on
bean methods.

```
@Configuration
@ImportRuntimeHints(CustomRuntimeHintsRegistrar.class)
public class MyConfiguration {

  @Bean
  @ImportRuntimeHints(OtherRuntimeHintsRegistrar.class)
  public MyBean myBean() {
    //...
  }
}
```

Closes gh-28160
2022-04-14 13:06:43 +02:00
Sam Brannen 1574fed90b Merge branch '5.3.x' 2022-04-13 10:08:31 +02:00
Sam Brannen a7cf19cec5 Improve documentation and matching algorithm in data binders 2022-04-13 09:55:40 +02:00
Sam Brannen c9e7816762 Merge branch '5.3.x' 2022-04-09 10:43:02 +02:00
Sam Brannen 6fad00ed22 Ensure dynamic proxy with AOP introduction includes lambda interfaces
Closes gh-28209
2022-04-09 09:57:43 +02:00
Juergen Hoeller 9ae35e78b1 Merge branch '5.3.x'
# Conflicts:
#	spring-context-support/src/test/java/org/springframework/validation/beanvalidation2/ValidatorFactoryTests.java
#	spring-context/src/test/java/org/springframework/validation/beanvalidation/ValidatorFactoryTests.java
#	spring-web/src/main/java/org/springframework/http/server/reactive/ServletServerHttpRequest.java
2022-04-08 14:42:12 +02:00
Juergen Hoeller 35de7e19ee Introduce initializer callback for Bean Validation Configuration
Closes gh-27956
2022-04-08 14:39:36 +02:00
Juergen Hoeller 10e979e58b Polishing 2022-04-08 14:37:41 +02:00
Juergen Hoeller 7e1782ea22 Merge branch '5.3.x'
# Conflicts:
#	build.gradle
#	spring-core/src/main/java/org/springframework/core/convert/Property.java
2022-04-08 13:10:34 +02:00
Juergen Hoeller 4143b445d6 Polishing 2022-04-08 13:04:14 +02:00
Juergen Hoeller 12d8010395 Merge branch '5.3.x' 2022-03-25 18:08:55 +01:00
Juergen Hoeller 35610a535d Expose cancel(mayInterruptIfRunning) variant in ScheduledTask
Closes gh-28233
2022-03-25 18:06:31 +01:00
Sam Brannen d11389e783 Merge branch '5.3.x' 2022-03-21 17:13:30 +01:00
Sam Brannen 8fc744f4f4 Improve Javadoc for BeanExpressionResolver 2022-03-21 16:57:27 +01:00
Sam Brannen 3da7a48a17 Explicitly close ApplicationContexts and clean up warnings in tests 2022-03-20 13:19:25 +01:00
Sam Brannen 7f4e09e994 Merge branch '5.3.x'
# Conflicts:
#	spring-context/src/test/java/org/springframework/context/event/PayloadApplicationEventTests.java
#	spring-context/src/test/java/org/springframework/context/groovy/GroovyApplicationContextTests.java
#	spring-context/src/test/java/org/springframework/format/datetime/joda/DateTimeFormatterFactoryBeanTests.java
#	spring-context/src/test/java/org/springframework/format/datetime/joda/DateTimeFormatterFactoryTests.java
#	spring-context/src/test/java/org/springframework/format/datetime/joda/JodaTimeFormattingTests.java
#	spring-context/src/test/java/org/springframework/format/support/FormattingConversionServiceTests.java
#	spring-context/src/test/java/org/springframework/remoting/rmi/RmiSupportTests.java
#	spring-context/src/test/java/org/springframework/scripting/support/StandardScriptFactoryTests.java
#	spring-web/src/test/java/org/springframework/remoting/caucho/CauchoRemotingTests.java
#	spring-web/src/test/java/org/springframework/remoting/httpinvoker/HttpComponentsHttpInvokerRequestExecutorTests.java
2022-03-20 12:55:39 +01:00
Sam Brannen 9a5891e6e6 Explicitly close ApplicationContexts and clean up warnings in tests
This commit also ensures that various test methods actually test
something now.
2022-03-20 12:34:56 +01:00
Stephane Nicoll 0cbea29517 Polish 2022-03-18 18:25:30 +01:00
Sam Brannen 2fb1dd177b Remove obsolete org.springframework.core.NestedIOException
This commit removes Spring's custom NestedIOException and replaces its
usage with the standard IOException which has supported a root cause
since Java 6.

Closes gh-28198
2022-03-18 16:56:56 +01:00
Sam Brannen b570f60560 Merge branch '5.3.x'
# Conflicts:
#	spring-aop/src/main/java/org/springframework/aop/support/AopUtils.java
#	spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationClassFilter.java
#	spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMatchingPointcut.java
#	spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMethodMatcher.java
#	spring-beans/src/main/java/org/springframework/beans/factory/annotation/RequiredAnnotationBeanPostProcessor.java
#	spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java
#	spring-context/src/main/java/org/springframework/jmx/export/annotation/ManagedNotification.java
#	spring-context/src/main/java/org/springframework/jmx/export/annotation/ManagedOperationParameter.java
#	spring-core/src/main/java/org/springframework/javapoet/support/package-info.java
#	spring-core/src/main/java/org/springframework/util/TypeUtils.java
#	spring-web/src/main/java/org/springframework/http/HttpMethod.java
2022-03-18 16:47:12 +01:00
Sam Brannen 64b64d9ba0 Stop referring to features as "Java 5" features
With a Java 8 baseline in place for quite some time now, it no longer
makes sense to refer to features such as annotations as "Java 5
annotations".

This commit also removes old `Tiger*Tests` classes, thereby avoiding
duplicate execution of various tests.
2022-03-18 16:32:30 +01:00
Sam Brannen 1419172fbd Polish Javadoc for JMX support 2022-03-18 15:25:35 +01:00
Sam Brannen 4db2f8ea1b Remove obsolete Nashorn-based scripting tests
Since the Nashorn JavaScript engine was removed in Java 15, these tests
will never be run on a Java 17+ JDK which is required as of Spring
Framework 6.0.

See gh-27919
2022-03-15 16:33:52 +01:00
Stephane Nicoll 672555a568 Add support of init and destroy methods
This commit updates InitDestroyBeanPostProcessor so that it contributes
init or destroy method names to the `RootBeanDefinition`. This is then
used by the generator to provide these methods to the optimized AOT
context.

Invocation of those init methods still happen using reflection so
dedicated hints are contributed for them.

Closes gh-28151
2022-03-12 13:35:56 +01:00
izeye 2a9a1f1c3a Add Javadoc since for GenericApplicationContext.refreshForAotProcessing()
See gh-28171
2022-03-12 11:42:36 +01:00
Stephane Nicoll 9b07457d06 Introduce ApplicationContextAotGenerator
This commit introduces a way to process a GenericApplicationContext
ahead of time. Components that can contribute in that phase are
invoked, and their contributions are recorded in the
GeneratedTypeContext.

This commit also expands BeanFactoryContribution so that it can exclude
bean definitions that are no longer required.

Closes gh-28150
2022-03-09 11:17:21 +01:00
Stephane Nicoll b5695b9248 Add support for refreshing a GenericApplicationContext for AOT
This commit adds a way to refresh a GenericApplicationContext for ahead
of time processing: refreshForAotProcessing() processes the bean factory
up to a point where it is about to create bean instances.

MergedBeanDefinitionPostProcessor implementations are the only bean
post processors that are invoked during this phase.

Closes gh-28065
2022-03-09 11:17:21 +01:00
Stephane Nicoll 9ba927215e Add support for ImportAware callback
This commit adds a way for a BeanFactoryPostProcessor to participate to
AOT optimizations by contributing code that replaces its runtime
behaviour.

ConfigurationClassPostProcessor does implement this new interface and
computes a mapping of the ImportAware configuration classes. The mapping
is generated for latter reuse by ImportAwareAotBeanPostProcessor.

Closes gh-2811
2022-03-09 11:17:21 +01:00
Sam Brannen 66e9095ee9 Fix links and tests broken during merge
See gh-28083
2022-03-01 17:03:59 +01:00
Sam Brannen 466dd825ac Merge branch '5.3.x'
# Conflicts:
#	spring-beans/src/main/java/org/springframework/beans/factory/annotation/InitDestroyAnnotationBeanPostProcessor.java
#	spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java
#	spring-beans/src/main/java/org/springframework/beans/factory/support/DisposableBeanAdapter.java
#	spring-context/src/test/java/org/springframework/context/annotation/Spr3775InitDestroyLifecycleTests.java
2022-03-01 16:48:24 +01:00
Sam Brannen dcdea986f6 Polish init/destroy lifecycle method tests
See gh-28083
2022-03-01 15:43:25 +01:00
Sam Brannen a524857bd5 Fix init/destroy lifecycle method tests
See gh-28083
2022-03-01 15:23:15 +01:00
Vikey Chen af14eea1ef Introduce tests for gh-28083 2022-03-01 15:22:51 +01:00
Arjen Poutsma 65394b00ea Merge branch '5.3.x' 2022-02-24 14:50:18 +01:00
Arjen Poutsma 7e2106b850 Refactor roll forward in CronField
Before this commit, CronField.Type::rollForward added temporal units
to reach the higher order field. This caused issues with DST, where
the added amount of hours was either too small or too large.

This commit refactors the implementation so that it now adds one to the
higher order field, and reset the current field to the minimum value.

Closes gh-28095
2022-02-24 14:47:02 +01:00
Sam Brannen be8224a590 Polish contribution
See gh-27818
2022-02-19 16:04:55 +01:00
Guirong Hu 01214b3473 Allow @Async qualifier to be declared with a placeholder or SpEL expression
Closes gh-27818
2022-02-19 15:09:40 +01:00
Sam Brannen 8c6d59aaaf Polish contribution
See gh-28014
2022-02-19 14:43:26 +01:00
a.yazychyan c5c926726d Use enhanced switch expressions where feasible
Closes gh-28014
2022-02-19 14:34:05 +01:00
Juergen Hoeller 4a470e0a37 Prevent @Bean method overloading by default (with enforceUniqueMethods flag)
Closes gh-22609
2022-02-17 22:37:34 +01:00
Juergen Hoeller 41ee23345d Support for registering multiple init/destroy methods on AbstractBeanDefinition
Closes gh-28013
2022-02-17 18:14:09 +01:00
Sam Brannen c1987e5b8c Merge branch '5.3.x' 2022-02-16 12:12:37 +01:00
Sam Brannen e3ceb9b23d Polish @Target declarations for stereotype annotations 2022-02-16 12:01:14 +01:00
Arjen Poutsma 3463106532 Merge branch '5.3.x' 2022-02-16 11:24:10 +01:00
Arjen Poutsma 5ab966fbde Polish contribution
See gh-28038
2022-02-16 11:16:38 +01:00
vikey 7276752e7c Fix CronExpression issue with DST
This commit fixes an issue with CronExpression fails to calculate next
execution on the day of daylight saving time.

Closes gh-28038
2022-02-16 11:16:38 +01:00
Sam Brannen 2cee63491d Remove deprecated SocketUtils
Closes gh-28052
2022-02-15 16:19:11 +01:00
Sam Brannen 7412625929 Merge branch '5.3.x'
# Conflicts:
#	spring-web/src/test/java/org/springframework/remoting/caucho/CauchoRemotingTests.java
#	spring-webflux/src/test/java/org/springframework/web/reactive/function/client/WebClientIntegrationTests.java
2022-02-15 14:35:25 +01:00
Sam Brannen 685a195ba1 Deprecate SocketUtils
SocketUtils was introduced in Spring Framework 4.0, primarily to assist
in writing integration tests which start an external server on an
available random port. However, these utilities make no guarantee about
the subsequent availability of a given port and are therefore
unreliable. Instead of using SocketUtils to find an available local
port for a server, it is recommended that users rely on a server's
ability to start on a random port that it selects or is assigned by the
operating system. To interact with that server, the user should query
the server for the port it is currently using.

SocketUtils is now deprecated in 5.3.16 and will be removed in 6.0.

Closes gh-28052
2022-02-15 14:28:58 +01:00
Juergen Hoeller 3eb9886724 Merge branch '5.3.x'
# Conflicts:
#	spring-context-support/src/main/java/org/springframework/scheduling/commonj/WorkManagerTaskExecutor.java
#	spring-core/src/main/java/org/springframework/core/task/SimpleAsyncTaskExecutor.java
#	spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java
#	spring-tx/src/main/java/org/springframework/jca/work/SimpleTaskWorkManager.java
#	spring-tx/src/main/java/org/springframework/jca/work/WorkManagerTaskExecutor.java
2022-02-04 23:24:21 +01:00
Juergen Hoeller a71a45e719 Deprecate AsyncTaskExecutor.execute(Runnable task, long startTimeout)
Closes gh-27959
2022-02-04 23:21:00 +01:00
Sam Brannen 4358b48b08 Merge branch '5.3.x' 2022-02-04 20:01:48 +01:00
Sam Brannen 5d7a632965 Ensure Spring AOP generates JDK dynamic proxies for lambdas
Prior to this commit, if AOP proxy generation was configured with
proxyTargetClass=true (which is the default behavior in recent versions
of Spring Boot), beans implemented as lambda expressions or method
references could not be proxied with CGLIB on Java 16 or higher without
specifying `--add-opens java.base/java.lang=ALL-UNNAMED`.

This commit addresses this shortcoming by ensuring that beans
implemented as lambda expressions or method references are always
proxied using a JDK dynamic proxy even if proxyTargetClass=true.

Closes gh-27971
2022-02-04 19:59:35 +01:00
Sam Brannen b3f786728e Use modern language features in tests 2022-02-03 15:35:32 +01:00
Sam Brannen 32cd73261a Apply "switch expressions" where applicable 2022-02-03 15:21:18 +01:00
Sam Brannen 54565e95b5 Merge branch '5.3.x' 2022-02-03 14:58:36 +01:00
Sam Brannen f8a5a8d7be Use modern language features in tests 2022-02-03 14:50:10 +01:00
Arjen Poutsma 6e4551131d Merge branch '5.3.x' 2022-02-01 13:52:52 +01:00
Arjen Poutsma 8f9a1cdc0c Consider current date in "1W" cron expressions
Prior to this commit, the QuartzCronField::weekdayNearestTo would elapse
until the next month before checking if the current day matched.

After this commit, the current day is checked before we elapse until
the next month.

Closes gh-27966
2022-02-01 13:51:40 +01:00
Stephane Nicoll 84e6d2a95c Merge branch '5.3.x' 2022-01-26 14:12:26 +01:00
Stephane Nicoll 6a6c7df824 Polish "Add CacheErrorHandler implementation that logs exceptions"
See gh-27826
2022-01-26 14:10:49 +01:00
Adam Ostrožlík 5c9fbcc23c Add CacheErrorHandler implementation that logs exceptions
See gh-27826
2022-01-26 14:10:49 +01:00
Sam Brannen f64cc08b62 Apply "instanceof pattern matching" in additional core classes 2022-01-26 13:49:50 +01:00
Sam Brannen 54c7f53eff Avoid use of `var` declarations
See gh-27945.
2022-01-21 19:25:44 +01:00
Sam Brannen 9af2c9d55d Overhaul GroovyBeanDefinitionReaderTests
This commit switches from CGLIB-based proxies to JDK dynamic proxies
for AOP and scoped-bean tests, in order to be able to run tests in the
Eclipse IDE without special Run Configuration setup for the Java module
system.

This commit also simplifies the loading of beans defined with the Groovy
DSL.

See gh-27945
2022-01-21 11:16:35 +01:00
Sam Brannen e94e67cd93 Polish GroovyApplicationContextTests
See gh-27945
2022-01-21 11:16:35 +01:00
Sam Brannen 1cf2960eb6 Use AssertJ instead of Groovy Assertions
See gh-27945
2022-01-21 11:16:35 +01:00
Sam Brannen a6deac3ffe Polish contribution
See gh-27945
2022-01-21 10:33:32 +01:00
Dave Syer f7c3706361 Port GroovyDynamicElementReader to Java
Prior to this commit, GroovyDynamicElementReader was implemented in
Groovy, which required that developers have Groovy language support
installed and configured in their IDEs.

This commit ports GroovyDynamicElementReader from Groovy to Java,
making the compilation much simpler and allowing developers to open the
project in Eclipse or VSCode (or other IDEs without Groovy support)
without compiler errors.

This commit also converts related tests from Groovy to Java.

Closes gh-27945
2022-01-20 17:42:17 +01:00
Sam Brannen e565d2cabb Apply "instanceof pattern matching" in PropertySourcesPlaceholderConfigurer
See gh-27947
2022-01-18 16:23:41 +01:00
Sam Brannen d72cf89ebf Make PropertySourcesPlaceholderConfigurerTests pass on JDK 17
This change is required in Eclipse IDE but not for the Gradle build.

See gh-27947
2022-01-18 16:21:26 +01:00
Sam Brannen 4a51e4bbc7 Merge branch '5.3.x' 2022-01-18 16:16:10 +01:00
Sam Brannen 5c76ff5ef6 Ensure unresolvable placeholders can be ignored with @Value
Prior to this commit, if a PropertySourcesPlaceholderConfigurer bean
was configured with its ignoreUnresolvablePlaceholders flag set to
true, unresolvable placeholders in an @Value annotation were not
ignored, resulting in a BeanCreationException for the bean using @Value.

For example, given a property declared as `my.app.var = ${var}` without
a corresponding `var` property declared, an attempt to resolve
`@Value("${my.app.var}")` resulted in the following exception.

java.lang.IllegalArgumentException: Could not resolve placeholder 'var' in value "${var}"

This commit fixes this by modifying
PropertySourcesPlaceholderConfigurer's postProcessBeanFactory(...)
method so that a local PropertyResolver is created if the
ignoreUnresolvablePlaceholders flag is set to true. The local
PropertyResolver then enforces that flag, since the Environment in the
ApplicationContext is most likely not configured with
ignoreUnresolvablePlaceholders set to true.

Closes gh-27947
2022-01-18 16:00:55 +01:00
Sam Brannen d57bc176f2 Merge branch '5.3.x' 2022-01-10 14:21:25 +01:00
Sam Brannen df263d01b9 Use idiomatic AssertJ assertions for true, false, and null 2022-01-10 14:15:55 +01:00
Marten Deinum 941b6af9ac Use Collection factory methods when applicable
This commit replaces the use of Collections.unmodifiableList/Set/Map
with the corresponding 'of(...)' factory methods introduced in Java 9.

Closes gh-27824
2022-01-04 12:01:13 +01:00
liuzhifei 7021eb5bb1 Apply "instanceof pattern matching" in additional locations
Closes gh-27696
2022-01-03 16:52:38 +01:00
Sam Brannen 6555d3b42d Suppress warnings in tests 2022-01-03 16:12:14 +01:00
Stephane Nicoll 900e0f56eb Polish "Fix typo and use of componentry"
See gh-27852
2021-12-29 11:05:27 +01:00
liuzhifei 65d2e9bb54 Fix typo and use of componentry
See gh-27852
2021-12-29 11:01:41 +01:00
Stephane Nicoll 7f73cb6726 Merge pull request #27864 from izeye
* pr/27864:
  Update copyright year of changed file
  Remove AsyncConfigurerSupport reference in EnableAsync Javadoc

Closes gh-27864
2021-12-29 10:56:40 +01:00
Stephane Nicoll 8a7a046bf0 Update copyright year of changed file
See gh-27864
2021-12-29 10:56:29 +01:00
izeye 88d4eac537 Remove AsyncConfigurerSupport reference in EnableAsync Javadoc
See gh-27864
2021-12-29 10:56:02 +01:00
Stephane Nicoll c204cc7ba0 Update copyright year of changed file
See gh-27863
2021-12-29 10:54:49 +01:00
izeye f0125afb5e Remove references to JCacheConfigurerSupport and CachingConfigurerSupport
See gh-27863
2021-12-29 10:53:56 +01:00
Stephane Nicoll 772630caf1 Polish "Add Javadoc since to new PayloadApplicationEvent constructor"
See gh-27848
2021-12-27 12:15:27 +01:00
izeye f3fd7b156e Add Javadoc since to new PayloadApplicationEvent constructor
See gh-27848
2021-12-27 12:14:44 +01:00
izeye 713795cc34 Polish
See gh-27827
2021-12-21 09:36:08 +01:00
Juergen Hoeller 9dc5c9f935 Merge branch '5.3.x'
# Conflicts:
#	build.gradle
2021-12-15 21:52:16 +01:00
Juergen Hoeller d665977787 Polishing 2021-12-15 21:50:30 +01:00
Juergen Hoeller 96e2fc69ed Merge branch '5.3.x'
# Conflicts:
#	build.gradle
#	spring-core/src/main/java/org/springframework/core/type/StandardAnnotationMetadata.java
#	spring-core/src/main/java/org/springframework/core/type/classreading/SimpleAnnotationMetadata.java
2021-12-15 18:03:51 +01:00
Juergen Hoeller 1885ab3e07 Polishing 2021-12-15 17:58:28 +01:00
Stephane Nicoll 2f3a9dbc68 Deprecate CachingConfigurerSupport and AsyncConfigurerSupport
Closes gh-27813
2021-12-15 12:03:39 +01:00
Stephane Nicoll b6faaf1fc1 Merge branch '5.3.x' 2021-12-15 10:59:50 +01:00
Stephane Nicoll de10bb69cb Stop resolving AsyncConfigurer instances eagerly
Closes gh-27808
2021-12-15 10:53:09 +01:00
Stephane Nicoll c7642422c3 Stop resolving CachingConfigurer instances eagerly
Closes gh-27751
2021-12-15 10:52:09 +01:00
Juergen Hoeller 3e6eb987d0 Clean up 5.3.x merge result
See gh-27726
2021-12-14 17:01:17 +01:00
Juergen Hoeller bfdb93b406 Merge branch '5.3.x'
# Conflicts:
#	build.gradle
#	src/docs/asciidoc/integration.adoc
2021-12-14 16:51:00 +01:00
Juergen Hoeller 4b7d9b1f9c Avoid compilation warning for test class with serializable base class 2021-12-14 16:48:07 +01:00
Juergen Hoeller ca84559588 Provide findAnnotationOnBean variant with allowFactoryBeanInit flag
Closes gh-27796
2021-12-14 16:47:12 +01:00
Juergen Hoeller d7b9270672 Clarify SchedulerFactoryBean's LocalDataSourceJobStore overriding
Includes clarification of interface-level cache annotations for target-class proxies.

Closes gh-27709
See gh-27726
2021-12-14 16:46:13 +01:00
Juergen Hoeller c44447f622 Avoid early initialization of empty interceptor names
Closes gh-12238
2021-12-14 16:46:01 +01:00
Brian Clozel bb53a99def Upgrade to Kotlin 1.6.10
Closes gh-27413
2021-12-14 15:25:50 +01:00
Stephane Nicoll 8d93dc4abb Merge branch '5.3.x' 2021-12-14 14:05:18 +01:00
Stephane Nicoll b06d267232 Remove references to AsyncConfigurerSupport
Closes gh-27812
2021-12-14 13:59:05 +01:00
Kwangyong Kim ceea00f733 Fix cache annotation tip
Even if using cglib proxy mode, annotations on an interface can be recognized.

Signed-off-by: Kwangyong Kim <banana.yong@gmail.com>
2021-12-14 13:51:20 +01:00
Stephane Nicoll 8422d9d22f Add default methods to CachingConfigurer
This commit adds default methods to CachingConfigurer and
JCacheConfigurer and removes the reference to their respective support
classes as they are now irrelevant.

Closes gh-27811
2021-12-14 13:49:57 +01:00
Juergen Hoeller 37bebeaaaf Accept protected @Transactional/Cacheable methods on CGLIB proxies
Closes gh-25582
2021-12-14 09:41:23 +01:00
Yanming Zhou d836fb4a7a Remove unnecessary @SuppressWarnings
See gh-27807
2021-12-13 09:34:22 +01:00
Juergen Hoeller 7f43128a0e Merge branch '5.3.x'
# Conflicts:
#	build.gradle
#	spring-web/src/main/java/org/springframework/web/server/MediaTypeNotSupportedStatusException.java
#	spring-web/src/main/java/org/springframework/web/util/ContentCachingRequestWrapper.java
#	spring-webmvc/src/main/java/org/springframework/web/servlet/handler/HandlerMappingIntrospector.java
2021-12-03 22:42:05 +01:00
Juergen Hoeller 14f24f43d7 Polishing 2021-12-03 22:36:31 +01:00
Stephane Nicoll 110e0f7f2b Add support for Instant in @DateTimeFormat
Closes gh-19846
2021-12-03 16:17:52 +01:00
Stephane Nicoll a57ea39707 Polish "Add support for YearMonth and MonthDay in @DateTimeFormat"
See gh-1215
2021-12-03 11:20:04 +01:00
Kazuki Shimizu 65eceafeee Add support for YearMonth and MonthDay in @DateTimeFormat
See gh-1215
2021-12-03 10:59:38 +01:00
Stephane Nicoll 65dc2afe9d Polish "Add Kotlin extensions for Cache and CacheManager"
See gh-23927
2021-12-02 14:51:29 +01:00
sokomishalov 5ec1e20242 Add Kotlin extensions for Cache and CacheManager
See gh-23927
2021-12-02 14:51:29 +01:00
Stephane Nicoll 792b366bda Polish "Add support for explicit generic type in PayloadApplicationEvent"
See gh-24599
2021-12-02 10:20:08 +01:00
陈其苗 6283456ef2 Add support for explicit generic type in PayloadApplicationEvent
See gh-24599
2021-12-02 09:38:48 +01:00
김보배(Bobae Kim)/Platform Engineering팀/11ST 804b343cab Use parseInt without substring method 2021-11-25 16:14:59 +01:00
Brian Clozel 79d3f5c64c Merge branch '5.3.x' 2021-11-24 21:34:55 +01:00
Brian Clozel d019c1f82b Polish
See gh-2030
2021-11-24 21:34:23 +01:00
Stephane Nicoll 51ecbdecd8 Merge branch '5.3.x' 2021-11-24 16:29:52 +01:00
Stephane Nicoll a1b2695c3a Polish "Clarify behaviour of AnnotationBeanNameGenerator with acronyms"
See gh-2030
2021-11-24 16:29:13 +01:00
Mateusz 341f4882ed Clarify behaviour of AnnotationBeanNameGenerator with acronyms
Name transformation is delegated to Introspector#decapitalize, which
states "but in the (unusual) special case when there is more than one
character and both the first and second characters are upper case, we
leave it alone.". This commit clarifies this behavior.

See gh-2030
2021-11-24 16:00:22 +01:00
Rossen Stoyanchev dcc342ccc5 Merge branch '5.3.x' into main 2021-11-24 13:14:55 +00:00
Rossen Stoyanchev 3f7dec0b0d Polishing contribution
Closes gh-699
2021-11-24 13:05:05 +00:00
Marco Krikke 830cc3450f Improved DataBinder Javadoc for xxx*yyy pattern matching
The default documentation does not mention xxx*yyy pattern matching,
which is, however, supported by PatternMatchUtils. Such a pattern
can be useful for matching nested properties in all elements of a
collection, e.g. property[*].nestedProperty.

See gh-699
2021-11-24 13:05:05 +00:00
Stephane Nicoll d5f36c7e2c Merge branch '5.3.x' 2021-11-24 14:02:57 +01:00
Stephane Nicoll 19a8b94b21 Polish "Expose prestartAllCoreThreads on ExecutorService"
See gh-1246
2021-11-23 17:17:22 +01:00
Federico Donnarumma 2c53e9e308 Expose prestartAllCoreThreads on ExecutorService
See gh-1246
2021-11-23 16:14:39 +01:00
Juergen Hoeller 4750a9430c Early removal of 5.x-deprecated code
Closes gh-27686
2021-11-18 09:18:06 +01:00
Juergen Hoeller 54bd66755c Consistently replace String encoding names with StandardCharset arguments
Closes gh-27664
2021-11-10 15:19:51 +01:00
Juergen Hoeller 0e1ba7aae5 Merge branch '5.3.x'
# Conflicts:
#	build.gradle
#	spring-context/src/main/java/org/springframework/context/annotation/Lazy.java
2021-11-09 22:39:58 +01:00
Juergen Hoeller b167e1a93f Remove unnecessary final declarations (for consistency) 2021-11-09 22:35:24 +01:00
Juergen Hoeller 9bc09631d6 Recommend ObjectProvider as alternative to @Lazy for optional dependencies
Closes gh-27649
2021-11-09 22:29:56 +01:00
Sam Brannen ebfec822cb Merge branch '5.3.x' 2021-11-05 10:33:54 +01:00
Sam Brannen ff1485fd8d Fix log message formatting in CandidateComponentsIndexLoader 2021-11-05 10:31:10 +01:00
Sam Brannen 32c14a2b42 Update Javadoc regarding repeatable annotation support 2021-10-29 11:04:01 +02:00
Stephane Nicoll 5ea1cf532e Merge branch '5.3.x' 2021-10-28 14:21:53 +02:00
Stephane Nicoll f295c8b2fb Polish "Add support for custom expression parsing"
See gh-27604
2021-10-28 14:20:15 +02:00
Xjzon 40d84c297b Add support for custom expression parsing
See gh-27604
2021-10-28 13:57:15 +02:00
Sam Brannen c989470f94 Remove unused code in FormattingConversionServiceTests
This commit removes test code that became obsolete with the removal of
Joda Time support.
2021-10-25 17:12:55 +02:00
Sam Brannen 267df1c0f2 Merge branch '5.3.x' 2021-10-25 17:07:29 +02:00
Sam Brannen c4c3d59d07 Remove unused code in FormattingConversionServiceTests 2021-10-25 17:02:58 +02:00
Sam Brannen e4e667acdb Polishing 2021-10-23 18:02:55 +02:00
Sam Brannen 63509e64d4 Merge branch '5.3.x' 2021-10-23 17:47:55 +02:00
Kenzo Spaulding 4ec8ae42f4 Add test cases to SpEL's MapAccessorTests
Closes gh-26981
2021-10-23 17:45:37 +02:00
Sam Brannen 71036e7da5 Merge branch '5.3.x' 2021-10-21 14:16:24 +02:00
Sam Brannen 7a54ff2d21 Extract public TypeFilterUtils from ComponentScanAnnotationParser
Prior to this commit, third parties using @ComponentScan's @Filter
annotation had to implement their own parsing for @Filter
AnnotationAttributes as well as instantiation of the corresponding
TypeFilters. In such cases the various *Aware callbacks
(BeanFactoryAware, EnvironmentAware, etc.) should also be supported.

This commit therefore extracts a new public TypeFilterUtils class from
ComponentScanAnnotationParser so that third parties can benefit from
consistent TypeFilter creation from @ComponentScan @Filter annotations.

Closes gh-27553
2021-10-21 14:15:38 +02:00
Sam Brannen 67333a3f94 Apply "instanceof pattern matching" Eclipse clean-up in spring-context
This commit also applies additional clean-up tasks such as the following.

- final fields
- diamond operator (<>) for anonymous inner classes
- Comparator.comparing
- convert to switch expression

This has only been applied to `src/main/java`.
2021-10-14 17:33:53 +02:00
Juergen Hoeller da457abd5b Merge branch '5.3.x' 2021-10-12 15:19:40 +02:00
Juergen Hoeller e4934a90eb Use TriggerContext's Clock instead of new Date()
Closes gh-27546
2021-10-12 15:17:18 +02:00
Juergen Hoeller 715f300fa1 Avoid expensive isReadable() check during classpath scan
Closes gh-25741
See gh-21372
2021-10-12 15:15:51 +02:00
Sam Brannen 87cb84b832 Merge branch '5.3.x' 2021-10-12 12:27:55 +02:00
Sam Brannen 5bd90538b3 Introduce test for gh-27499 and polish contribution 2021-10-12 12:22:24 +02:00
Nick 50ccb1bfcd Avoid duplicate JCacheOperationSource bean registration in <cache:annotation-driven />
In our application we use XML context and <cache:annotation-driven />
declaration. Also we disable bean definition duplication by setting
GenericApplicationContext.setAllowBeanDefinitionOverriding(false) in an
ApplicationContextInitializer. This combination leads to a
BeanDefinitionOverrideException because the
DefaultJCacheOperationSource bean is registered twice.

 - once for: parserContext.getReaderContext().registerWithGeneratedName(sourceDef);
 - once for: parserContext.registerBeanComponent(new BeanComponentDefinition(sourceDef, sourceName));

This commit refactors JCacheCachingConfigurer.registerCacheAspect(...)
so that the JCacheOperationSource bean is registered only once.

Closes gh-27499
2021-10-12 12:05:30 +02:00
Sam Brannen 2d1e0d5e38 Merge branch '5.3.x' 2021-10-06 12:13:21 +02:00
Sam Brannen 41ae9632d1 Upgrade to Checkstyle 9.0 and spring-javaformat 0.0.29
This commit upgrades the Gradle build to use Checkstyle 9.0 and
spring-javaformat 0.0.29 (which internally uses Checkstyle 8.45.1).

Closes gh-27520
2021-10-06 12:11:19 +02:00
Sam Brannen 381b7d035a Merge branch '5.3.x' 2021-10-05 14:55:22 +02:00
Sam Brannen 48a507a993 Clean up warnings 2021-10-05 14:35:32 +02:00
Juergen Hoeller e314a79fb0 Merge branch '5.3.x'
# Conflicts:
#	spring-beans/src/main/java/org/springframework/beans/factory/support/DisposableBeanAdapter.java
2021-10-01 13:29:46 +02:00
Juergen Hoeller f632165dec Invoke bean-derived (Auto)Closeable.close() method directly
Closes gh-27504
2021-10-01 13:26:25 +02:00
Sam Brannen 030ba52805 Merge branch '5.3.x' 2021-09-29 16:56:33 +02:00
Sam Brannen 96e4d3a530 Fail Gradle build for Javadoc warnings
In order to catch Javadoc errors in the build, we now enable the
`Xwerror` flag for the `javadoc` tool. In addition, we now use
`Xdoclint:syntax` instead of `Xdoclint:none` in order to validate
syntax within our Javadoc.

This commit fixes all resulting Javadoc errors and warnings.

This commit also upgrades to Undertow 2.2.12.Final and fixes the
artifact names for exclusions for the Servlet and annotations APIs.

The incorrect exclusion of the Servlet API resulted in the Servlet API
being on the classpath twice for the javadoc task, which resulted in the
following warnings in previous builds.

javadoc: warning - Multiple sources of package comments found for package "javax.servlet"
javadoc: warning - Multiple sources of package comments found for package "javax.servlet.http"
javadoc: warning - Multiple sources of package comments found for package "javax.servlet.descriptor"
javadoc: warning - Multiple sources of package comments found for package "javax.servlet.annotation"

Closes gh-27480
2021-09-29 14:02:37 +02:00
Juergen Hoeller f32f04d841 Code cleanup on new baseline 2021-09-28 19:02:44 +02:00
Juergen Hoeller 4d7fa9a632 Merge branch '5.3.x'
# Conflicts:
#	spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java
2021-09-28 18:18:23 +02:00
Juergen Hoeller 86b010a6b2 Defensive reference to JNDI API for JDK 9+ (optional `java.naming` module)
Closes gh-27483
2021-09-28 18:15:22 +02:00
Sam Brannen 08bce08018 Use text blocks with JUnit Jupiter 5.8.1
See gh-27450
2021-09-28 14:20:31 +02:00
Sam Brannen 93efb20a53 Fix broken links in Javadoc
This commit removes several links that were broken due to the removal
of various APIs in 6.0.

See gh-27480
2021-09-28 13:34:33 +02:00
Sam Brannen 3dc84c2d92 Merge branch '5.3.x' 2021-09-28 11:48:50 +02:00
Sam Brannen bfdc99ab79 Fix Javadoc errors
See gh-27480
2021-09-28 11:44:12 +02:00
Sam Brannen 16bf39ea1b Merge branch '5.3.x' 2021-09-28 10:35:18 +02:00
Sam Brannen 2567b20949 Upgrade to spring-javaformat 0.0.28 and downgrade to Checkstyle 8.41
In order to be able to use text blocks and other new Java language
features, we are upgrading to a recent version of Checkstyle.

The latest version of spring-javaformat-checkstyle (0.0.28) is built
against Checkstyle 8.32 which does not include support for language
features such as text blocks. Support for text blocks was added in
Checkstyle 8.36.

In addition, there is a binary compatibility issue between
spring-javaformat-checkstyle 0.0.28 and Checkstyle 8.42. Thus we cannot
use Checkstyle 8.42 or higher.

In this commit, we therefore upgrade to spring-javaformat-checkstyle
0.0.28 and downgrade to Checkstyle 8.41.

This change is being applied to `5.3.x` as well as `main` in order to
benefit from the enhanced checking provided in more recent versions of
Checkstyle.

Closes gh-27481
2021-09-28 10:29:31 +02:00
Juergen Hoeller 8f96ca4a2d Merge branch '5.3.x'
# Conflicts:
#	spring-context/spring-context.gradle
#	spring-core/src/main/java/org/springframework/core/ReactiveAdapterRegistry.java
2021-09-21 17:47:27 +02:00
Juergen Hoeller 1f8c233dfc Polishing 2021-09-21 17:43:03 +02:00
Juergen Hoeller 0dc5d2794f Avoid early ConversionService determination in StandardBeanExpressionResolver
Closes gh-27446
2021-09-21 17:42:50 +02:00
Juergen Hoeller 774583dfa7 Retain support for legacy PostConstruct/PreDestroy/Inject variants
Also removes JAX-WS support from CommonAnnotationBeanPostProcessor.

Closes gh-27444
See gh-27422
2021-09-21 17:07:42 +02:00
Juergen Hoeller d84ca2ba90 Jakarta EE 9 migration
Upgrades many dependency declarations; removes old EJB 2.x support and outdated Servlet-based integrations (Commons FileUpload, FreeMarker JSP support, Tiles).

Closes gh-22093
Closes gh-25354
Closes gh-26185
Closes gh-27423
See gh-27424
2021-09-17 09:14:07 +02:00
Juergen Hoeller 5822f1bf85 Drop RPC-style remoting
Closes gh-27422
2021-09-17 08:59:58 +02:00
Juergen Hoeller b7b078d26e Remove Joda-Time support
Closes gh-27426
2021-09-17 08:58:40 +02:00
Juergen Hoeller cf2429b0f0 Remove support for deprecated Java SecurityManager (-> JDK 17 build compatibility)
Includes hard JDK 9+ API dependency in CGLIB ReflectUtils (Lookup.defineClass) and removal of OutputStream spy proxy usage (avoiding invalid Mockito proxy on JDK 17)

Closes gh-26901
2021-09-15 15:30:25 +02:00
Sam Brannen ae56f2ac09 Polish contribution
See gh-27336
2021-08-30 16:54:16 +02:00
Philippe Marschall debf61b948
Remove unused private loggers
Closes gh-27336
2021-08-30 16:51:59 +02:00
Sam Brannen c27ec00ae9 Polish scheduling Javadoc 2021-08-26 14:09:23 +02:00
Sam Brannen 9a7fb7022d Fix typo in @Scheduled
See gh-27309
2021-08-26 13:43:48 +02:00
Sam Brannen bd72e4498b Revise and document TimeUnit support in @Scheduled
This commit also fixes a bug introduced in commit e99b43b91e, where
java.time.Duration strings were converted to milliseconds and then
converted again using the configured TimeUnit.

See gh-27309
2021-08-25 20:55:55 +02:00
Axzial e99b43b91e Support TimeUnit in the @Scheduled annotation
This commit introduces a new `timeUnit` attribute in the @Scheduled
annotation to allow the user to specify a time unit other than
milliseconds.

Closes gh-27309
2021-08-25 20:50:37 +02:00
Syuziko eaf9deedfd Polish tests
See gh-27248
2021-08-07 18:53:47 +02:00
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