Commit Graph

23764 Commits

Author SHA1 Message Date
Sam Brannen
68757073b0 Merge branch '5.3.x' 2022-03-02 17:29:26 +01:00
Sam Brannen
340f41af6d Suppress warnings in Gradle build 2022-03-02 17:28:45 +01:00
Sam Brannen
25aa295c2c Rename test class to adhere to conventions 2022-03-02 17:25:37 +01:00
Sam Brannen
14ae522172 Merge branch '5.3.x' 2022-03-01 19:10:54 +01:00
Sam Brannen
67b91b2390 Polish RollbackRuleTests
See gh-28098
2022-03-01 19:10:33 +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
d67034f99b Document semantics for externally managed init/destroy methods
This commit introduces Javadoc to explain the difference between
init/destroy method names when such methods are private, namely that a
private method is registered via its qualified method name; whereas, a
non-private method is registered via its simple name.

See gh-28083
2022-03-01 16:18:46 +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
Sam Brannen
f96872404d Ensure private init/destroy method is invoked only once
Closes gh-28083
2022-03-01 15:03:10 +01:00
Sam Brannen
a7d5fbfbea Fix log messages for init/destroy method registration 2022-03-01 15:03:10 +01:00
Sam Brannen
27ee9cdcde Merge branch '5.3.x' 2022-02-28 17:18:32 +01:00
Sam Brannen
84de100fc6 Polishing 2022-02-28 17:15:43 +01:00
Sam Brannen
beab8ab4e7 Test claims regarding SpEL support for T(Character)
See gh-28112
2022-02-28 17:15:43 +01:00
Brian Clozel
c9795597c8 Merge branch '5.3.x' 2022-02-28 16:39:55 +01:00
Brian Clozel
6f41180cc5 Align AsyncRestTemplate error logging with RestTemplate
Prior to this commit, `AsyncRestTemplate` would log errors (including
simple 404s) with WARN level. Such errors are quite common and should
not clutter logs.

This commit aligns the logging strategy with RestTemplate, using the
DEBUG level for such cases.

Fixes gh-28049
2022-02-28 16:37:07 +01:00
Brian Clozel
9340e9b716 Upgrade to Kotlin 1.6.20-RC 2022-02-28 15:56:14 +01:00
rstoyanchev
c03def79d4 Fix test failures
See gh-27052
2022-02-28 14:17:04 +00:00
rstoyanchev
b045e5baef Tests for ErrorResponse hierarchy to verify the output
See gh-27052
2022-02-28 13:40:05 +00:00
rstoyanchev
679432ece6 DefaultHandlerExceptionResolver supports ErrorResponse
DefaultHandlerExceptionResolver now supports ErrorResponse exceptions
and can map them to HTTP status and headers of the response. This
includes not only exceptions from spring-web,  but also any other
exception that implements ErrorResponse.

ResponseEntityExceptionHandler is updated along the same lines, now
also handling any ErrorResponseException. It can be used it for
RFC 7807 support for Spring MVC's own exceptions.

See gh-27052
2022-02-28 13:40:05 +00:00
rstoyanchev
76be6373a8 ErrorResponse support in Spring MVC exception hierarchy
All Spring MVC exceptions from spring-web, now implement ErrorResponse
and expose HTTP error response information, including an RFC 7807 body.

See gh-27052
2022-02-28 13:40:05 +00:00
rstoyanchev
3efedef161 Add ErrorResponse and ErrorResponseException
ErrorResponse represents a complete error response with status, headers,
and an  RFC 7807 ProblemDetail body.

ErrorResponseException implements ErrorResponse and is usable on its
own or as a base class. ResponseStatusException extends
ErrorResponseException and now also supports RFC 7807 and so does its
sub-hierarchy.

ErrorResponse can be returned from `@ExceptionHandler` methods and is
mapped to ResponseEntity.

See gh-27052
2022-02-28 13:40:05 +00:00
rstoyanchev
714d451260 Add ProblemDetail and @ExceptionHandler support
ProblemDetail is a representation of an RFC 7807 "problem", and this
commits adds support for it in Spring MVC and WebFlux as a return value
from `@ExceptionHandler` methods, optionally wrapped with
ResponseEntity for headers.

See gh-27052
2022-02-28 13:40:05 +00: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
Stephane Nicoll
5e75f6e009 Merge branch '5.3.x' 2022-02-24 10:55:29 +01:00
Stephane Nicoll
453c6d41f7 Fix Objenesis version
See gh-28100
2022-02-24 10:54:52 +01:00
Stephane Nicoll
33004a9efd Merge pull request #28100 from izeye
* pr/28100:
  Fix library name for JavaPoet in src/docs/dist/license.txt

Closes gh-28100
2022-02-24 10:52:21 +01:00
izeye
a28b49ac27 Fix library name for JavaPoet in src/docs/dist/license.txt
This commit also updates Objenesis version in the file to align with the
version that Spring Framework is using.

See gh-28100
2022-02-24 10:51:54 +01:00
Stephane Nicoll
b4eb895927 Polish naming
Co-authored-by: Andy Wilkinson <wilkinsona@vmware.com>
2022-02-22 16:07:52 +01:00
Sam Brannen
e85001f332 Clean up warnings in test fixture 2022-02-19 17:32:15 +01:00
Sam Brannen
819d4256b7 Remove deprecated "enclosing classes" search strategy for MergedAnnotations
Closes gh-28080
2022-02-19 17:25:50 +01:00
Sam Brannen
ad3095f197 Merge branch '5.3.x' 2022-02-19 17:02:02 +01:00
Sam Brannen
84b4cebb39 Fix (@)since tag in SpelMessage
See gh-28043
2022-02-19 16:54:16 +01:00
Sam Brannen
5689395678 Deprecate "enclosing classes" search strategy for MergedAnnotations
The TYPE_HIERARCHY_AND_ENCLOSING_CLASSES search strategy for
MergedAnnotations was originally introduced to support @Nested test
classes in JUnit Jupiter (see #23378).

However, while implementing #19930, we determined that the
TYPE_HIERARCHY_AND_ENCLOSING_CLASSES search strategy unfortunately
could not be used since it does not allow the user to control when to
recurse up the enclosing class hierarchy. For example, this search
strategy will automatically search on enclosing classes for static
nested classes as well as for inner classes, when the user probably
only wants one such category of "enclosing class" to be searched.
Consequently, TestContextAnnotationUtils was introduced in the Spring
TestContext Framework to address the shortcomings of the
TYPE_HIERARCHY_AND_ENCLOSING_CLASSES search strategy.

Since this search strategy is unlikely to be useful to general users,
the team has decided to deprecate this search strategy in Spring
Framework 5.3.x and remove it in 6.0.

Closes gh-28079
2022-02-19 16:51:00 +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
6a73d2655f Polishing 2022-02-19 14:59:54 +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
Phillip Webb
42d114534b Polish BeanDefinitionRegistrar 2022-02-18 17:13:07 +01:00
Sam Brannen
8c5a407a7d Suppress deprecation warnings in tests in build 2022-02-18 16:22:43 +01:00
Sam Brannen
968efb34f6 Merge branch '5.3.x' 2022-02-18 16:18:36 +01:00
Sam Brannen
071c2988d5 Suppress deprecation warnings in tests in build 2022-02-18 16:18:13 +01:00
Sam Brannen
6c832598c9 Merge branch '5.3.x' 2022-02-18 15:32:58 +01:00
Sam Brannen
94af2ca06b Recover from error during SpEL MIXED mode compilation
Prior to this commit, SpEL was able to recover from an error that
occurred while running a CompiledExpression; however, SpEL was not able
to recover from an error that occurred while compiling the expression
(such as a java.lang.VerifyError). The latter can occur when multiple
threads concurrently change types involved in the expression, such as
the concrete type of a custom variable registered via
EvaluationContext.setVariable(...), which can result in SpEL generating
invalid bytecode.

This commit addresses this issue by catching exceptions thrown while
compiling an expression and updating the `failedAttempts` and
`interpretedCount` counters accordingly. If an exception is caught
while operating in SpelCompilerMode.IMMEDIATE mode, the exception will
be propagated via a SpelEvaluationException with a new
SpelMessage.EXCEPTION_COMPILING_EXPRESSION error category.

Closes gh-28043
2022-02-18 15:31:59 +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