Commit Graph

25945 Commits

Author SHA1 Message Date
Sam Brannen af2481f6da Merge branch '5.3.x' 2022-09-14 15:54:34 +02:00
Johnny Lim 5f5d383eeb Fix Javadoc since tag for AbstractGenericWebContextLoader.createContext()
See gh-28983
Closes gh-29154
2022-09-14 15:53:18 +02:00
Sam Brannen a2445dcb8a Polishing 2022-09-14 15:27:11 +02:00
Sam Brannen 911d1f2dea Suppress warnings 2022-09-14 15:27:11 +02:00
Stephane Nicoll e9997d4004 Polish 2022-09-14 14:40:02 +02:00
Sam Brannen 354117da7f Merge branch '5.3.x' 2022-09-14 14:38:10 +02:00
Sam Brannen 529481c44c Polish contribution
See gh-29150
2022-09-14 14:35:43 +02:00
Jens Dietrich 35d379f9d3 Add missing @Nullable in SettableListenableFuture
Closes gh-29150
2022-09-14 14:32:37 +02:00
rstoyanchev e370c15bc6 Fix error handling regression for non-streaming Flux
Closes gh-29038
2022-09-14 12:00:31 +01:00
Juergen Hoeller 3307630a95 Upgrade to Jackson 2.13.4, Netty 4.1.82, Tomcat 10.0.23, Undertow 2.2.19, Hibernate ORM 5.6.11, Hibernate Validator 7.0.5 2022-09-14 12:56:16 +02:00
Juergen Hoeller 50d34366bc Polishing 2022-09-14 12:55:53 +02:00
Stephane Nicoll 6feeeec70e Upgrade to Micrometer 1.10.0-M6
Closes gh-29151
2022-09-14 11:53:24 +02:00
Brian Clozel d3d91d4d22 Merge branch '5.3.x' 2022-09-13 21:41:10 +02:00
Brian Clozel c871758a51 Upgrade to Reactor 2020.0.23
Closes gh-29129
2022-09-13 21:35:11 +02:00
Brian Clozel 9c48dda4f3 Upgrade to Reactor 2022.0.0-M6 2022-09-13 21:29:47 +02:00
Brian Clozel 19d991a67b Revisit resource cleanup in ClientHttpRequestFactory
Prior to this commit, resource management around
`ClientHttpRequestFactory` and `RestTemplate` was unclear. Some
factories implementation were implementing a `DisposableBean` and other
contracts were not managing request factory resources.

In the meantime, neither `ClientHttpRequestFactory` nor `RestTemplate`
are typically meant to be contributed as beans to the application
context. Most often, they're instantiated within beans and their
lifecycle should be managed by those.

This commit makes all `ClientHttpRequestFactory` `Closeable` and ensures
that all existing implementations have a similar behavior between
`dispose()` and `close()`. Since `RestTemplate` (actually
`HttpAccessor`) can instantiate factories on its own, they also now
extend `Closeable` to properly close those resources, if not externally
managed.

Closes gh-29010
2022-09-13 15:53:01 +02:00
Arjen Poutsma 71f9a84d22 Fix releasing bug in StringDecoder
This commit fixes an issue in StringDecoder, where, if the buffer did
not contain any delimiters, it was released before it was relayed to
any subscribers.

Closes gh-29119
2022-09-13 15:46:24 +02:00
Sébastien Deleuze 2687de0fe8 Add HandshakeWebSocketService runtime hints
Closes gh-29146
2022-09-13 15:37:06 +02:00
Brian Clozel 241261b6b6 Polish
See gh-28341
2022-09-13 14:00:55 +02:00
Brian Clozel 5f62d1dc8e Add className variants in ReflectionHintsPredicates
This commit adds predicates variants that accept `String className`
instead of actual `Class<?>` when checking for fields and method hints.
This is useful when the type under test is not visible from the current
test class.

Closes gh-29143
2022-09-13 14:00:55 +02:00
Sébastien Deleuze 198e17f659 Add AbstractEntityManagerFactoryBean proxy hints for Hibernate
Closes gh-29138
2022-09-13 13:52:27 +02:00
Sam Brannen 948c9b85a0 Revise internals of AOT testing support 2022-09-13 13:06:33 +02:00
Sam Brannen e7a297a948 Rename TestAotMappings to AotTestContextInitializers
- for consistency with AotTestAttributes and similar classes

See gh-28205, gh-28204
2022-09-13 12:07:30 +02:00
Sam Brannen a3b6b41bd7 Polish BootstrapUtils 2022-09-13 11:28:57 +02:00
Sam Brannen 1e2541a0a3 Remove support for setting default CacheAwareContextLoaderDelegate
The ability to set a system property to change the default
CacheAwareContextLoaderDelegate was only needed by the Spring Native
project in the Spring Framework 5.3.x line and should not be used by
other projects.

This commit therefore reverts the changes made in conjunction with
gh-27540.

Closes gh-29061
2022-09-13 11:14:51 +02:00
Sébastien Deleuze a711ed59f6 Set hibernate.bytecode.provider to none on native image
Closes gh-29140
2022-09-13 10:18:40 +02:00
Sébastien Deleuze 6fed342543 Refine DefaultPersistenceUnitManager#determineDefaultPersistenceUnitRootUrl
This commit refines the implementation to be more
lenient when defaultPersistenceUnitRootLocation is equals
to ORIGINAL_DEFAULT_PERSISTENCE_UNIT_ROOT_LOCATION and an
IOException is thrown, which happens when running on
native image.

Closes gh-29137
2022-09-13 10:18:40 +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
Sam Brannen b0ee513db6 Introduce AotTestAttributes mechanism in the TestContext framework
For certain use cases it is beneficial to be able to compute something
during AOT build-time processing and then retrieve the result of that
computation during AOT run-time execution, without having to deal with
code generation on your own.

To support such use cases, this commit introduces an AotTestAttributes
mechanism in the Spring TestContext Framework with the following
feature set.

- conceptually similar to org.springframework.core.AttributeAccessor in
  the sense that attributes are generic metadata

- allows an AOT-aware test component to contribute a key-value pair
  during the AOT build-time processing phase, where the key is a String
  and the value is a String

- provides convenience methods for storing and retrieving attributes as
  boolean values

- generates the necessary source code during the AOT build-time
  processing phase in the TestContext framework to create a persistent
  map of the attributes

- provides a mechanism for accessing the stored attributes during AOT
  run-time execution

Closes gh-29100
2022-09-12 20:32:36 +02:00
Sam Brannen d3822a2eb9 Revert workaround for Java 8 compiler bug 2022-09-12 18:24:00 +02:00
Brian Clozel bfac042301 Polish
See gh-28341
2022-09-12 18:02:56 +02:00
Sam Brannen 349bcb4364 Suppress warnings 2022-09-12 17:46:03 +02:00
Sam Brannen e653ee60a0 Polish ClassPathResourceTests 2022-09-12 17:40:43 +02:00
Sam Brannen 138f9c64be Consistently return absolute path from ClassPathResource#getPath
Prior to this commit, the Javadoc for the getPath() method in
ClassPathResource stated the following.

> Return the path for this resource (as resource path within the class path).

That implied the returned path was an "absolute path" within the class
path; however, that was not always true.

If the resource was created using ClassPathResource(String) or
ClassPathResource(String, ClassLoader), the returned path was a cleaned
version of the ABSOLUTE PATH supplied to the constructor, WITHOUT a
leading slash.

If the resource was created using ClassPathResource(String, Class) with
an absolute path, the returned path was a cleaned version of the
ABSOLUTE PATH supplied to the constructor, WITH a leading slash.

If the resource was created using ClassPathResource(String, Class) with
a relative path, the returned path was a cleaned version of the
RELATIVE PATH supplied to the constructor.

In addition, ClassPathResource does not provide public access the Class
passed to the ClassPathResource(String, Class) constructor.

Consequently, the path returned by getPath() could not be reliably used
with ClassLoader.getResource(String) or with the recently introduced
registerResource(Resource) method in ResourceHints.

This commit addresses this issue by ensuring that getPath()
consistently returns the absolute path within the class path without a
leading slash.

See gh-29083
Reverts gh-29094
Closes gh-29099
2022-09-12 17:40:43 +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
rstoyanchev bbe5e91ebc Minor change in ReactorNetty2TcpClient
A follow-up on recent addition of ReactorNetty2TcpClient and switch to
Netty 5 Buffer.
2022-09-12 14:23:15 +01:00
Stephane Nicoll 58a2b79699 Harmonize hint registration
Previously, a shortcut method for the default ExecutableMode was
provided, but we found out that the shortcut makes it harder to
determine the intent.

This commit harmonizes hints registration for types, methods, and
fields. An ExecutableMode is now mandatory to register a method or
constructor. Previous methods that infer a mode or provided a
customizer of the builder are deprecated.

Closes gh-29135
2022-09-12 14:51:04 +02:00
Stephane Nicoll c8f7a76659 Merge pull request #29130 from sreenath-tm
* pr/29130:
  Polish "Adapt FieldHint to recent GraalVM versions"
  Adapt FieldHint to recent GraalVM versions

Closes gh-29130
2022-09-12 14:50:44 +02:00
Stephane Nicoll 042a4f3518 Polish "Adapt FieldHint to recent GraalVM versions"
See gh-29130
2022-09-12 14:50:28 +02:00
SreenathTM 1cb5f00723 Adapt FieldHint to recent GraalVM versions
In recent GraalVM versions, allowWrite and allowUnsafeAccess have been
deprecated and are no longer use. This commit updates FieldHint to
remove the irrelevant properties.

See gh-29130
2022-09-12 14:50:28 +02:00
rstoyanchev c854e35c9d Merge branch '5.3.x' 2022-09-12 12:27:31 +01:00
rstoyanchev 4e97776969 Polishing contribution
Closes gh-28715
2022-09-12 11:47:55 +01:00
Sam Brannen a085a1b6b6 Polishing 2022-09-12 12:37:46 +02:00
Napster d42f950a36 Pass headers to STOMP receipt callbacks
See gh-28715
2022-09-12 10:55:12 +01:00
rstoyanchev 4eabe29b9a Polishing contribution
Closes gh-28785
2022-09-12 10:52:53 +01:00
Brian Clozel 82e47db28f Instrument reactive servers for Observability
This commit introduces a `HttpRequestsObservationWebFilter` which
instruments web frameworks using Spring's reactive `ServerHttpRequest`
and `ServerHttpResponse` interfaces.

This replaces Spring Boot's `MetricsWebFilter`.

See gh-28880
2022-09-12 11:38:20 +02:00
Brian Clozel 6eded96740 Instrument Servlet server apps for Observability
This commit introduces the new `HttpRequestsObservationFilter`
This `Filter` can be used to instrument Servlet-based web frameworks for
Micrometer Observations. While the Servlet request and responses are
automatically used for extracting KeyValues for observations, web
frameworks still need to provide the matching URL pattern, if supported.

This can be done by fetching the observation context from the request
attributes and contributing to it.

This commit instruments Spring MVC (annotation and functional variants),
effectively replacing Spring Boot's `WebMvcMetricsFilter`.

See gh-28880
2022-09-12 11:37:47 +02:00
Brian Clozel ac9360b624 Instrument WebClient for Observability
This commit introduces Micrometer as an API dependency to the
spring-webflux module. Micrometer is used here to instrument `WebClient`
and record `Observation` for HTTP client exchanges.

This replaces Spring Boot's `MetricsWebClientFilterFunction` which
instruments `WebClient` via an `ExchangeFilterFunction`. Here, a direct
instrumentation is more efficient and less prone to metrics errors.

See gh-28341
2022-09-12 11:37:47 +02:00
Brian Clozel a0ddcd07c8 Instrument RestTemplate for Observability
This commit introduces Micrometer as an API dependency to the spring-web
module. Micrometer is used here to instrument `RestTemplate` and record
`Observation` for HTTP client exchanges.

This will replace Spring Boot's `MetricsClientHttpRequestInterceptor`
which uses the request interceptor contract for instrumentation.
This approach is limited as measurements and tags aren't always precise
and overhead is more important than a direct instrumentation.

See gh-28341
2022-09-12 11:37:41 +02:00