Commit Graph

2330 Commits

Author SHA1 Message Date
Sam Brannen e4395f2f8b Clean up warnings and polishing 2022-07-31 14:14:56 +03:00
Rossen Stoyanchev 1aa4e7c68d Merge branch '5.3.x' 2022-07-29 16:20:51 +03:00
Johnny Lim 00f7f5ff0a Use MediaType.APPLICATION_FORM_URLENCODED_VALUE
See gh-28771
2022-07-29 14:40:45 +03: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
rstoyanchev 4c08c276f7 Avoid NPE in PathMatchConfigurer
Closes gh-28816
2022-07-13 20:23:55 +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
rstoyanchev 3badc47647 Polishing 2022-07-13 13:12:16 +01:00
rstoyanchev 263811ecfa Add WebFlux equivalent of ResponseEntityExceptionHandler
Closes gh-28665
2022-07-13 10:58:48 +01:00
rstoyanchev 380aedb12a Add ProblemDetailJacksonMixin
Closes gh-28665
2022-07-12 13:04:58 +01:00
Sam Brannen 1c03aaaddc Fix Javadoc in ResponseEntityExceptionHandler 2022-07-12 13:29:02 +02:00
Sam Brannen 285b1b483e Update Javadoc in DefaultHandlerExceptionResolver to reflect changes
See gh-27052
2022-07-12 11:00:39 +02:00
rstoyanchev b64835d2c8 Improve ResponseEntityExceptionHandler
- update handler methods for lower level exceptions to create a mapping
to a ProblemDetail.
- add protected method for creating the ResponseEntity that a subclass
can override to re-create ProblemDetail without overriding the rest
of what handleExceptionInternal does.
- update Javadoc and polishing

See gh-28439
2022-07-12 09:55:15 +01:00
Sam Brannen 87a2652604 Merge branch '5.3.x'
# Conflicts:
#	spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/support/DefaultHandlerExceptionResolver.java
2022-07-12 10:48:51 +02:00
Sam Brannen 5b1a84e395 Polish contribution
See gh-28789
2022-07-12 10:39:11 +02:00
Marc Wrobel 6985fa8057 Fix and improve Javadoc in spring-webmvc
Closes gh-28789
2022-07-12 10:39:03 +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
Sam Brannen a5ceb964b9 Improve display names in CrossOriginTests 2022-07-06 14:03:59 +02:00
Sam Brannen 0beee7dc69 Stop using convention-based attribute overrides in tests in spring-test and spring-mvc
See gh-28760
2022-07-06 14:01:28 +02:00
Sam Brannen b61ac6315a Merge branch '5.3.x'
# Conflicts:
#	spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerMacroTests.java
2022-07-05 13:27:09 +02:00
Sam Brannen 0621a8eff1 Fix concurrency issues in FreeMarkerMacroTests
Prior to this commit, tests in these two classes intermittently failed
with errors similar to the following, due to concurrent modification
of shared files.

expected:
  "<input type="text" id="name" name="name" value="Darren"     >"
 but was:
  "<input type="text" id="name" name="name" value="Darren"     >

  "hidden"/>"

This commit fixes this by creating a new temporary folder for each test
method invocation.
2022-07-05 13:17:50 +02:00
rstoyanchev a81ba68da1 Update remaining trailingSlashMatch default value
See gh-28552
2022-07-01 18:07:15 +01:00
rstoyanchev a575590c01 Merge branch '5.3.x' 2022-07-01 09:42:18 +01:00
rstoyanchev b95362a3fd Avoid request params access for form data in logRequest
Close gh-28587
2022-07-01 02:55:16 +01:00
rstoyanchev b312eca391 Deprecate and set trailingSlash option to false
Closes gh-28552
2022-06-29 16:09:10 +01:00
rstoyanchev 14fd2605a3 Deprecate UrlPathHelper shortcuts on AbstractHandlerMapping
Given the availability of two alternatives mechanisms for URL path
matching, PathPatternParser and AntPathMatcher, and now that
parsed patterns are enabled by default, it makes sense to reduce the
proliferation of options on AbstractHandlerMapping by deprecating
shortcuts related to String path matching. Most applications rely
on Boot and on the MVC config to do all this.

See gh-28607
2022-06-29 13:04:22 +01:00
rstoyanchev 92cf1e13e8 Enable use of parsed patterns by default in Spring MVC
Closes gh-28607
2022-06-29 10:17:27 +01:00
Sébastien Deleuze 22a750f378 Replace build-time initialization by constant fields
This commit leverages a subset of @philwebb initial experimentation
to compute at build time the value of specific boolean static fields
in native images. This enhancement is implemented for now as a
GraalVM feature.

The goal here is to keep an optimized footprint via build time code
removal without leveraging build-time class initialization which is known
for the blocking compatibility issues it introduces due to its viral nature.

For now, the static fields initialized at build time with native are:
 - NativeDetector#imageCode
 - Fields with a name ending by "Present" in "org.springframework" package
   typically used for classpath check with ClassUtils#isPresent

Closes gh-28624
2022-06-24 13:54:20 +02:00
rstoyanchev 98c7d8100d Remove "with" methods in ProblemDetail
ProblemDetail is intended to be extended with additional fields. This
commit removes its "with" methods for chained initialization to keep
it as plain as possible and avoid imposing a particular style on
subclasses.

See gh-27052
2022-06-24 11:08:32 +01:00
rstoyanchev 45ee7913bf Polishing ProblemDetail support
See gh-28665
2022-06-24 09:55:21 +01:00
Sam Brannen 04dde03451 Merge branch '5.3.x' 2022-06-20 16:03:09 +02:00
Sam Brannen e19e9757d4 Polishing 2022-06-20 15:19:02 +02:00
Juergen Hoeller aa48dec697 Merge branch '5.3.x'
# Conflicts:
#	build.gradle
#	spring-jms/src/main/java/org/springframework/jms/connection/CachingConnectionFactory.java
2022-06-14 15:14:10 +02:00
Juergen Hoeller 30c873b4b5 Move NestedServletExceptionTests to spring-web module
See gh-25162
2022-06-14 15:09:21 +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
rstoyanchev 933965b7b4 Merge branch '5.3.x' 2022-06-14 12:20:34 +01:00
rstoyanchev 8c777111fa Revise commit #52d068 with corrected test
Update test detecting RouterFunction beans in parent contexts to use
different bean names and avoid shadowing. Changed the fix accordingly
given that BeanProvider does detect beans in parent contexts.

See gh-28595
2022-06-14 10:07:56 +01:00
rstoyanchev d28d603081 Polishing
See gh-28595
2022-06-14 09:35:17 +01:00
rstoyanchev 52d0681ca1 WebMvc respects RouterFunction beans ordering
Closes gh-28595
2022-06-14 09:20:19 +01:00
Sébastien Deleuze 2b76a12b86 Refine build time init configuration
For Spring MVC and RestTemplate.

See gh-28518
2022-06-13 14:54:57 +02:00
Stephane Nicoll 0992f855e6 Add base infra for Web controllers hints
See gh-28518
2022-06-13 14:52:45 +02:00
Arjen Poutsma 216a266856 Polish 2022-06-08 17:00:58 +02:00
christophejan bbabf8d855 Add minimal Kotlin DSL RouterFunction attributes support
Closes gh-28567
2022-06-08 16:49:46 +02:00
christophejan 5b1bda5c7c Add test case on nested RouterFunction attributes 2022-06-08 16:49:46 +02:00
Sam Brannen 0a7a53af6d Polish contribution
See gh-27609
2022-06-03 13:59:55 +02:00
Vedran Pavic 864dcf67d8 Simplify default locale/timezone resolution in cookie/session locale resolvers
At present, the customization of the default locale and timezone
resolution in CookieLocaleResolver and SessionLocaleResolver requires
subclassing them and overriding determineDefaultLocale and/or
determineDefaultTimeZone methods.

This commit simplifies resolution of the default locale and timezone
resolution by introducing dedicated functions for these purposes, thus
allowing customization without needing to resort to subclassing the
locale resolvers.

Closes gh-27609
2022-06-03 13:59:46 +02:00
Vedran Pavic 94cc2da33b Update LocaleContextResolver to implement LocaleResolver
This commit updates LocaleContextResolver to implement LocaleResolver
using default methods, which simplifies AbstractLocaleContextResolver
and aligns it more closely with AbstractLocaleResolver.

See gh-27609
2022-06-03 13:59:38 +02:00
Vedran Pavic 9a0eb8db28 Update AcceptHeaderLocaleResolver to extend AbstractLocaleResolver
This commit updates AcceptHeaderLocaleResolver to extend
AbstractLocaleResolver, which allows the removal of defaultLocale
managing code in AcceptHeaderLocaleResolver.

See gh-27609
2022-06-03 13:59:30 +02:00