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
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
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
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
This new BOM dependency is necessary, as Spring Framework will implement
direct instrumentation with Micrometer as a mandatory or optional
dependency in several modules.
This commit extracts Mock HTTP client request and response for the
imperative variant. These are made available in the testFixtures
configuration for shared usage.
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
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
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
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
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
This commit renames registerResourceIfNecessary() to registerResource()
and throws an exception if the class path resource does not exist.
Closes gh-29083
This aligns the buffer size used in StreamUtils with the buffer sizes
used throughout the JDK (see InputStream, BufferedInputStream, Files).
Closes gh-28965
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
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.
`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.
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