Commit Graph

25945 Commits

Author SHA1 Message Date
Arjen Poutsma 0293e22910 Trying to fix flaky CoroutinesIntegrationTests 2022-09-30 15:54:01 +02:00
Stephane Nicoll 7e7e4efb01 Merge pull request #29230 from izeye
* pr/29230:
  Polish ReflectionHintsPredicates

Closes gh-29230
2022-09-30 15:30:49 +02:00
Johnny Lim 89db4efb67 Polish ReflectionHintsPredicates
See gh-29230
2022-09-30 15:23:35 +02:00
Brian Clozel 377d719b5f Add opens for Gradle test workers
After our upgrade to Gradle 7.5.1, our test suite requires changes to
our test configuration. See:

https://docs.gradle.org/7.5/userguide/upgrading_version_7.html#removes_implicit_add_opens_for_test_workers
2022-09-30 15:13:46 +02:00
Brian Clozel 8e24797d37 Merge branch '5.3.x' 2022-09-30 14:42:00 +02:00
Brian Clozel 777caef4f7 Upgrade to Gradle 7.5.1 2022-09-30 14:35:31 +02:00
rstoyanchev 5d2c9d946a Clean up conditional use of ChannelOperationsId
Closes gh-29224
2022-09-30 13:04:02 +01:00
Violeta Georgieva e81d30160c Remove useless constant reactorNettyRequestChannelOperationsIdPresent
`reactor.netty.ChannelOperationsId` is available in Reactor Netty 1.1.x from the very beginning.
2022-09-30 13:04:02 +01:00
rstoyanchev bc13d2b558 Remove unnecessary suppressing of deprecation
Closes gh-28870
2022-09-30 13:04:02 +01:00
Sam Brannen 2606557483 Polishing 2022-09-30 13:32:33 +02:00
Sam Brannen d21eea7de4 Fix recent regression in PathMatchingResourcePatternResolver
Commit 0eb66789ed which introduced generic FileSystem support in
PathMatchingResourcePatternResolver also introduced a regression in that
a matching folder is now returned in the results.

This commit address this by additionally using Files#isRegularFile() in
the predicate used to filter candidates.

Closes gh-29163
2022-09-30 13:05:31 +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
Brian Clozel d98e27cf79 Upgrade to Kotlin 1.7.20
This commit also temporarily changes a test assertion for the Jackson
Kotlin module.
As of https://youtrack.jetbrains.com/issue/KT-52932, Kotlin enhanced the
`IntRange` and this change is not supported yet by the Jackson Kotlin
module. An issue has been reported here:
FasterXML/jackson-module-kotlin#582

Closes gh-29225
2022-09-30 11:24:55 +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
Sébastien Deleuze 3eaf326997 Refine ConstantFieldSubstitutionProcessor error handling
The upgrade to SLF4J 2 via gh-29152 has broken
ConstantFieldSubstitutionProcessor when the class processed
has both a static boolean field to make constant at build
time and a static logger.

This issue is about catching and logging those errors,
skipping the processing of such fields which will be
then evaluated at runtime.

Closes gh-29219
2022-09-29 12:52:30 +02:00
Sébastien Deleuze 9b577a8955 Upgrade to SLF4J 2.0.2 and Log4j 2.19.0
Closes gh-29152
Closes gh-29217
2022-09-29 10:27:40 +02:00
rstoyanchev 9eaae0fe04 Polishing contribution and Theme deprecation notices
Closes gh-28870
2022-09-28 16:22:45 +01:00
Vedran Pavic cde92f5e1d Deprecate CookieGenerator
This commit deprecates CookieGenerator in favor of the more modern
alternative, ResponseCookie.

See gh-28870
2022-09-28 16:04:38 +01:00
rstoyanchev e6c2d44646 Better integrate ResponseCookie in CookieLocaleResolver
Improve ResponseCookie to allow an existing instance to be mutated
and also to set the cookie value through the builder. This allows
CookieLocaleResolver to avoid duplicating all the fields of
ResponseCookie and to have only a ResponseCookie field instead.

Closes gh-28779
2022-09-28 16:00:33 +01:00
rstoyanchev 075fccca94 Polishing contribution
See gh-28779
2022-09-28 16:00:33 +01:00
Vedran Pavic 7ea49fa9f4 Refactor CookieLocaleResolver
At present, CookieLocaleResolver extends CookieGenerator instead of
AbstractLocale(Context)Resolver like other LocaleResolver
implementations. This means it duplicates some common aspects of
LocaleResolver hierarchy while also exposing some CookieGenerator
operations, such as #addCookie and #removeCookie.

Additionally, CookieGenerator's support for writing cookies is based
on Servlet support which at current baseline doesn't support SameSite
directive.

This commit refactors CookieLocaleResolver to make it extend
AbstractLocaleContextResolver and also replaces CookieGenerator's
cookie writing support with newer and more capable ResponseCookie.
Simplify creation of CookieLocaleResolver with custom cookie name

This commit introduces CookieLocaleResolver constructor that accepts
cookie name thus allowing for a simpler creation of an instance with
the desired cookie name.

See gh-28779
2022-09-28 16:00:33 +01:00
Sam Brannen f6d1806e30 Ensure DefaultListableBeanFactoryTests compiles in Eclipse IDE 2022-09-28 15:44:45 +02:00
Sam Brannen 6cb131ac76 Polishing 2022-09-28 14:27:36 +02:00
Sam Brannen 0eb66789ed Introduce generic FileSystem support in PathMatchingResourcePatternResolver
This commit introduces support in PathMatchingResourcePatternResolver
for resolving files in a generic fashion using the
java.nio.file.FileSystem API, including preliminary support for class
path scanning within a GraalVM native image.

See included commits for details.

Closes gh-29163
2022-09-28 13:53:31 +02:00
Sam Brannen ccff526454 Reintroduce logging and exception handling for file system resource scanning
See gh-29163
2022-09-28 13:47:55 +02:00
Sam Brannen 7cb54de985 Apply root dir cleanup only for GraalVM native image resource scheme
See gh-29163
2022-09-28 13:47:44 +02:00
Sam Brannen 7a15805f6c Polish contribution
See gh-29163
2022-09-28 13:47:44 +02:00
Sam Brannen 0e22c3d89d Convert `file:` URL to FileSystemResource for backward compatibility
See gh-29163
2022-09-28 13:47:44 +02:00
Sam Brannen 508be4e0fa Update Javadoc to reflect changes
See gh-29163
2022-09-28 13:47:44 +02:00
Sam Brannen 385292dc41 Fix Checkstyle violations
See gh-29163
2022-09-28 13:47:44 +02:00
Dave Syer f751b38795 Use java.nio and FileSystems to resolve files in PathMatchingResourcePatternResolver
The JDK has decent support for walking a file system (via the
FileSystem API in java.nio.file), but prior to this commit Spring still
used hand-rolled pre-Java 7 code. Also, in principle, FileSystem can be
an abstraction used to express any hierarchy of resources through their
URIs. This is a good fit with the Spring Resource abstraction, and for
instance would mean that GraalVM native images could potentially do
classpath scanning through a custom URI and FileSystem already provided
by GraalVM.

In light of the above, this commit overhauls the implementation of
PathMatchingResourcePatternResolver to use a java.nio.file.FileSystem
to find matching resources within a file system.

As a side effect, several obsolete `protected` methods have been
removed from PathMatchingResourcePatternResolver.

See gh-29163
2022-09-28 13:39:48 +02:00
Stephane Nicoll c5fc0a5ef3 Add shortcut in TestGenerationContext 2022-09-28 11:20:35 +02:00
Stephane Nicoll 737967f924 Polish 2022-09-28 11:16:07 +02:00
Stephane Nicoll 38d91bafce Generate matching structure for configuration classes
This commit improves GeneratedClass to support inner classes, allowing
them to be registered by name with a type customizer, as
GeneratedClasses does for top level classes.

BeanDefinitionMethodGenerator leverages this feature to create a
matching structure for configuration classes that contain inner classes.

Closes gh-29213
2022-09-28 11:13:52 +02:00
rstoyanchev b1ee44f12e Polishing contribution
Closes gh-27280
2022-09-27 17:08:52 +01:00
Ashley Scopes d14477eb84 Add methods to DefaultResponseCreator & MockRestResponseCreators
New methods in DefaultResponseCreator for adding headers and cookies,
for specifying the character encoding when setting a string body on
a response, which is useful when working in environments that do not
automatically assume UTF-8, such as integrating with legacy
applications from a new Spring one.

New methods in MockRestResponseCreators support extra commonly used
HTTP status codes, including some that occur when working in AWS,
CloudFlare, or when using gateways such as Kong, where resilient
applications should be able to respond to ratelimits, gateway errors,
and gateway timeouts that may occur if a remote service is down.

Added test cases for any changes made.

See gh-27280
2022-09-27 15:58:44 +01:00
rstoyanchev badba7c3e9 Support coma-delimited format for origin values
Closes gh-27606
2022-09-27 14:49:18 +01:00
Arjen Poutsma d516667f37 Polish "Allow for CoroutineContext in invokeSuspendingFunction"
See gh-27193
2022-09-27 13:26:49 +02:00
Lukáš Křečan ff844ed99f Allow overriding invokeSuspendingFunction
This commit isolates the invocation of Kotlin coroutines into a separate
template method, so that it can be overridden in subclasses of
RequestMappingHandlerAdapter.

Closes gh-27195
2022-09-27 13:26:28 +02:00
rstoyanchev ac3ebc37dc Remove requestCompleted from RequestMappingHandlerAdapter
Closes gh-29002
2022-09-27 11:48:31 +01:00
rstoyanchev c135549a4e Conditional initialization of messageConverters
Closes gh-27854
2022-09-27 11:37:25 +01:00
Arjen Poutsma f80fbe30cc Allow for CoroutineContext in invokeSuspendingFunction
This commit adds an overloaded version of invokeSuspendingFunction
that specifies a CoroutineContext, instead of using
Dispatchers.Unconfined.

Closes gh-27193
2022-09-27 11:54:44 +02:00
Stephane Nicoll dd3e3b2989 Merge branch 'gh-29207'
Closes gh-29207
2022-09-27 10:33:27 +02:00
Stephane Nicoll e6aef11b09 Allow target to be a ClassName rather than an existing Class
See gh-29207
2022-09-27 10:33:14 +02:00
Stephane Nicoll 8ef850ff91 Update ClassNameGenerator to work with a ClassName target
This commit updates ClassNameGenerator so that it uses a ClassName for
its default target. This makes sure that a target that has been
generated can be used.

See gh-29027
2022-09-27 10:33:13 +02:00
Brian Clozel 1707a22c18 Merge branch '5.3.x' 2022-09-26 22:27:53 +02:00