Commit Graph

25110 Commits

Author SHA1 Message Date
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
Brian Clozel a68b46a2b6 Add Micrometer BOM 1.10 dependency management
This new BOM dependency is necessary, as Spring Framework will implement
direct instrumentation with Micrometer as a mandatory or optional
dependency in several modules.
2022-09-12 11:36:29 +02:00
Brian Clozel f9dcd428ae Extract Mock HTTP client requests and responses
This commit extracts Mock HTTP client request and response for the
imperative variant. These are made available in the testFixtures
configuration for shared usage.
2022-09-12 11:36:26 +02:00
npriebe cd10171f98 Make WebSocketConnectionManager#isConnected public
See gh-28785
2022-09-12 09:54:57 +01:00
jbotuck 597c687da8 Fix indentation in ref docs for RestTemplate
Closes gh-29014
2022-09-12 09:51:33 +01:00
rstoyanchev 3c5888c43f Polishing
See gh-28847
2022-09-12 09:37:11 +01:00
rstoyanchev 3a5f550a30 Support Reactor Netty 2 / Netty 5 in spring-messaging
Closes gh-28847
2022-09-12 09:37:11 +01:00
rstoyanchev 2f4c39ba2a Add classpath detection for Reactor Netty 2
See gh-28847
2022-09-12 09:37:11 +01:00
유예본(Yebon You)/Platform Engineering팀/11ST fa1f7f6dc7 Use InputStream's contracts instead of StreamUtils
Since Spring Framework 6.0 requires Java 17, we can now use
`InputStream` new contracts when manipulating streams.

Closes gh-27702
2022-09-12 10:21:50 +02:00
Brian Clozel 0770d86936 Deprecate StreamUtils.emptyInput()
Closes gh-29125
2022-09-12 10:21:50 +02:00
Patrick Strawderman d4a74c8f9d Update StreamUtils drain and emptyInput to use JDK builtins
Update StreamUtils.drain to use InputStream.transferTo with a null
OutputStream. This avoids allocating buffers for cases where the
supplied InputStream has an optimized transferTo method (e.g.,
ByteArrayInputStream and FileInputStream).

Additionally, update StreamUtils.emptyInput to simply call
InputStream.nullInputStream.

Closes gh-28961
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 fcb6baf2e9 All MethodReference to support a more flexible signature
Closes gh-29005
2022-09-12 10:09:01 +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
Sam Brannen 649c2f56fd Accept only ClassPathResource in ResourceHints#registerResource()
This commit throws an exception in registerResource() if the supplied
resource is not a ClassPathResource.

See gh-29083
2022-09-11 23:33:39 +02:00
Sam Brannen 7605ed7862 Improve tips for using endToEndTestsForEntireSpringTestModule()
See gh-29122
2022-09-10 20:09:47 +02:00
Sam Brannen 6d83a959fb Rename registerResourceIfNecessary to registerResource
This commit renames registerResourceIfNecessary() to registerResource()
and throws an exception if the class path resource does not exist.

Closes gh-29083
2022-09-10 19:49:56 +02:00
Sam Brannen d883c8fbb3 Polishing 2022-09-10 19:24:34 +02:00
Sam Brannen b429d6b5a6 Filter AOT end-to-end tests like in the actual build 2022-09-10 19:24:34 +02:00
Stephane Nicoll 70db83ac3a Merge branch '5.3.x' 2022-09-10 09:53:41 +02:00
Stephane Nicoll 081d70123e Start building against Reactor 2020.0.23 snapshots
See gh-29129
2022-09-10 09:44:11 +02:00
Stephane Nicoll 6927482b9c Start building against Reactor 2022.0.0-M6 snapshots
See gh-29128
2022-09-10 09:42:04 +02:00
Patrick Strawderman cdb38e8482 Increase StreamUtils.BUFFER_SIZE to 8192
This aligns the buffer size used in StreamUtils with the buffer sizes
used throughout the JDK (see InputStream, BufferedInputStream, Files).

Closes gh-28965
2022-09-09 22:04:10 +02:00
Brian Clozel c8ef2b2202 Upgrade Java versions in CI image 2022-09-09 20:45:27 +02:00
Brian Clozel 2b5ca63339 Fix serialization compiler warnings with Java 18
As of Java 18, the serial lint warning in javac has been expanded to
check for class fields that are not marked as `Serializable`.
See https://www.oracle.com/java/technologies/javase/18all-relnotes.html#JDK-8202056

In the Spring Framework codebase, this can happen with `Map`, `Set` or
`List` attributes which are often assigned with an unmodifiable
implementation variant. Such implementations are `Serializable` but
cannot be used as field types.

This commit ensures that the following changes are applied:
* fields are marked as transient if they can't be serialized
* classes are marked as `Serializable` if this was missing
* `@SuppressWarnings("serial")` is applied where relevant
2022-09-09 20:24:26 +02:00
Brian Clozel 82a4e374a1 Temporarily disable ORM tests on Java 18
This commit disables some ORM tests based on
`AbstractEntityManagerFactoryBeanTests` as those fail when the main
source set is built with Java 17 and tests are executed with Java 18.
2022-09-09 20:23:05 +02:00
Brian Clozel 21612eba19 Disable BlockHound tests on Java 18+
BlockHound is not currently compatible with Java 18.
2022-09-09 20:22:16 +02:00
Brian Clozel 1051fe7bee Improve InvocableHandlerMethod error handling
This commit improves the fix for gh-18491 for Java 18 as in this case
the exception message might not be null.
2022-09-09 20:20:29 +02:00
Brian Clozel 1dc3d5d2d6 Make HttpStatusCode extend Serializable
`HttpStatusCode` instance only hold an int value and are held by
`Serializable` classes, so this commit enforces this.

Without this change, Java 19+ will emit a compiler warning as
`Serializable` classes use `HttpStatusCode` as a field.
2022-09-09 19:56:00 +02:00
Brian Clozel a09811e73a Upgrade to HSQLDB 2.7.0 2022-09-09 19:55:26 +02:00
Phillip Webb 665deb4d82 Add examples to Javadoc for Throwing*.of factory methods
Closes gh-28969
2022-09-09 09:33:50 -07:00
Sam Brannen 1228f1cb58 Polishing 2022-09-09 18:32:38 +02:00
Sam Brannen ae864eb642 Introduce @Disabled end-to-end AOT tests for the spring-test module
This commit introduces endToEndTestsForEntireSpringTestModule() in
AotIntegrationTests to allow us to periodically check on our AOT
support.

Status quo:

- several test classes cannot be processed for AOT due to exceptions
  thrown during processing
- some generated classes fail to compile
- some tests fail

See gh-29122
2022-09-09 17:42:18 +02:00
Sam Brannen 94ff519072 Test JUnit 4, JUnit Jupiter, & TestNG in AotIntegrationTests
With this commit we also now assert the number of successfully
executed tests.
2022-09-09 17:15:54 +02:00