Commit Graph

41 Commits

Author SHA1 Message Date
Andy Wilkinson 4e6ce7b141 Merge branch '4.0.x'
Closes gh-48844
2026-01-15 14:31:24 +00:00
Andy Wilkinson 625571c3d1 Fix MVC and WebFlux validator creation in a native image
Following modularization, a presence check for ValidatorAdapter was
needed in the MVC and WebFlux auto-configuratiomn when creating
their Validators. Runtime hints to allow this check to work in a
native image were not added at the same time, resulting in the
class appearing to be absent. This caused message interpolation
for constraint violations to fail as newly created Validator was
being used which lacked the necessary MessageInterpolator
configuration.

This commit adds reflection hints for ValidatorAdapter, allowing
re-use of the context's main validator as the MVC and WebFlux
validators.

Fixes gh-48828
2026-01-15 14:12:33 +00:00
Andy Wilkinson ef1f4e2fa2 Merge branch '4.0.x'
Closes gh-48700
2026-01-08 12:01:09 +00:00
Andy Wilkinson 9bd1a460a1 Correct packaging of test code
Closes gh-48699
2026-01-08 11:43:43 +00:00
Phillip Webb 21cf377f7e Add 'WAR_SOURCE_DIRECTORY' environment variable support
Add an escape hatch for users that deviate from the standard
`src/main/webbapp` directory structure.

Fixes gh-23829
2026-01-05 16:44:45 -08:00
Moritz Halbritter ce1efb02a1 Back off if spring-boot-micrometer-observation or spring-boot-micrometer-metrics is missing
Closes gh-48581
2025-12-19 11:25:32 +01:00
Kai Zander fb05d82650 Fix order comment in WebMvcWebApplicationTypeDeducer
See gh-48543

Signed-off-by: Kai Zander <61500114+kzander91@users.noreply.github.com>
2025-12-16 09:14:34 +01:00
Phillip Webb da516741b2 Consider modules when deducing WebApplicationType
Introduce a strategy to `WebApplicationType` to allow modules to
implement deduction logic.

Prior to this commit, modules played no part in deducing the
`WebApplicationType`. This meant that a user with `spring-webflux`
for client purposes would deduce `REACTIVE` despite no
`spring-boot-webflux` module being present.

The following deduction logic order is now implemented:

1) If the `spring-boot-webmvc` module is being used and Spring MVC
   classes are found then `SERVLET` is used.

2) If the `spring-boot-webflux` module is being used and Spring WebFlux
   classes are found then `REACTIVE` is used.

3) If `spring-web` is found and servlet classes are available then
   `SERVLET` is used.

4) If none of the above are satisfied, `NONE` is used.

This commit also updates `SpringBootTestContextBootstrapper` to use
the same deduction logic.

Fixes gh-48517
2025-12-15 20:30:16 -08:00
Phillip Webb e93f9c313c Guard against WebServerApplicationContext not being present
Update security matchers and WebFlux actuator support to guard against
the `WebServerApplicationContext` class not being present.

Fixes gh-48388
2025-12-03 22:41:32 -08:00
Andy Wilkinson 3becdc7d47 Move server.error properties to spring.web.error
Closes gh-48201
2025-11-20 11:55:23 +00:00
Stéphane Nicoll 3d23261f87 Merge branch '3.5.x'
Closes gh-48122
2025-11-13 14:55:19 +01:00
Stéphane Nicoll d1e5fe3248 Merge branch '3.5.x'
Closes gh-48106
2025-11-13 10:31:25 +01:00
Phillip Webb 619454548b Restore support for Jersey
Restore support for Jersey now that it supports JAX-RS 4.

Closes gh-47967

Co-authored-by: Andy Wilkinson <andy.wilkinson@broadcom.com>
2025-11-05 10:51:08 -08:00
Phillip Webb 827b0c14a9 Rename OnlyOnceLoggingDenyMeterFilter
Rename `OnlyOnceLoggingDenyMeterFilter` to
`MaximumAllowableTagsMeterFilter`.

Closes gh-47925
2025-11-03 20:56:28 -08:00
Phillip Webb 7849474291 Merge branch '3.5.x'
Closes gh-47924
2025-11-03 20:41:23 -08:00
Andy Wilkinson bf8e0c45a8 Allow customizations of default customizers to be overridden
Previously, the default client and server HTTP message converter
customizers were ordered with lowest precedence. This made it
impossible to guarantee that another customizer would be able to go
after the default customizers, preventing their customizations from
being reliably overridden.

This commit updates the definitions of the default customizers to
order them at 0. This allows additional customizers to be ordered
either before or after them. Usage of the customizers is now always
ordered (previously Spring MVC's was not).

See gh-47798
2025-10-27 12:41:31 +00:00
Phillip Webb 183d765b4d Support actuator with Jackson 2 only
See gh-47688
2025-10-17 13:17:19 -07:00
Moritz Halbritter 73aa73f50d Add nullability annotations to tests in module/spring-boot-webmvc
See gh-47263
2025-10-16 11:24:40 +02:00
Phillip Webb cba4f7ae21 Consistently package mappings and exchanges classes
Mirror the package names used in actuator for classes to support
mappings and exchanges in `spring-boot-servlet`, `spring-boot-webmvc`
and `spring-boot-webflux`.

Closes gh-46217
2025-10-15 15:56:41 -07:00
Andy Wilkinson 55e7c83498 Allow modules to contribute to Devtools' default properties
Closes gh-44792
2025-10-15 20:19:02 +01:00
Phillip Webb 34e0382858 Move actuator heath code to spring-boot-health
Closes gh-46357
2025-10-14 21:51:24 -07:00
Andy Wilkinson 5afbec7033 Correct package in spring-boot-resttestclient to match module name
See gh-46356
See gh-47322
2025-10-10 12:50:48 +01:00
Phillip Webb e01b36216a Revert Support pluggable types for EndpointJsonMapper
Closes gh-46534
2025-10-09 22:48:45 -07:00
Andy Wilkinson 9eb05ebb10 Create spring-boot-resttestclient and spring-boot-webtestclient modules
Create `spring-boot-resttestclient` and `spring-boot-webtestclient`
modules to hold test client auto-configuration and `TestRestTemplate`
code.

Previous these classes were contained in `spring-boot-resetclient-test`
and `spring-boot-webclient-test` which was incorrect since the `-test`
modules should hold code need to test the given modules, not supporting
test classes.

See gh-46356

Co-authored-by: Phillip Webb <phil.webb@broadcom.com>
2025-10-09 22:12:39 -07:00
Brian Clozel 92ee73df30 Deprecate HttpMessageConverters for Framework's
Prior to this commit, Spring Boot had an  `HttpMessageConverters` class
that allowed, to configure message converter instances for MVC server
applications and traditional Spring HTTP clients.

As of Spring Framework 7.0, Framework ships its own
`HttpMessageConverters` class, aligning with the existing codecs
configuration on the WebFlux side. As a result, a few methods taking
`List<HttpMessageConverter>` as arguments were deprecated in favor of
the new arrangement.

This commit adapts to the Framework changes by deprecating Boot's
`HttpMessageConverters` in favor of Framework's. This splits the client
and server configuration as they are meant to be managed separately.
Applications can still contribute `HttpMessageConverters` (Boot's
variant) beans but the type itself is now deprecated.
Instead, applications should now contribute
`ClientHttpMessageConvertersCustomizer` and
`ServerHttpMessageConvertersCustomizer` beans to customize message
converters.

Closes gh-46411
2025-10-02 15:22:13 +02:00
Phillip Webb 2a521ce4e9 Remove spring-boot-web-server-test module
Remove the `spring-boot-web-server-test` module, adding
`SpringBootTestRandomPortContextCustomizerFactory` to
`spring-boot-web-server` as a replacement for
`SpringBootTestRandomPortApplicationListener`.

See gh-46356
See gh-47322
2025-10-01 21:54:54 -07:00
Phillip Webb 97c89b480f Move @LocalServerPort and @LocalManagementServerPort
Move `@LocalServerPort` and `@LocalManagementServerPort` back to
`spring-boot-test`. The should help reduce upgrade pain since these
annotations are fairly commonly used. It also removes the need for
depending on `spring-boot-webserver-test`.

This is slight compromise with the module structure, since the
web-server module usually contributes the properties referenced
by the annotations.

See gh-46356
See gh-47322
2025-10-01 21:53:58 -07:00
Phillip Webb bba56ffc8b Move RestTestClientBuilderCustomizer to spring-boot-test
Relocate `RestTestClientBuilderCustomizer` to `spring-boot-test`
and break the direct link to web-server by making use of
`spring.factories` and the new `BaseUrlProviders` class.

See gh-46356
2025-10-01 21:51:20 -07:00
Andy Wilkinson 5348880b69 Modularize spring-boot-test-autoconfigure
This commit modularizes spring-boot-test-autoconfigure. It now
contains only the code that's central to test auto-configuration.
Feature-specific functionality has moved out into -test modules,
some existing and some newly created. For example, `@DataJpaTest` can
now be found in spring-boot-data-jpa-test.

Closes gh-47322
2025-09-25 13:11:35 +01:00
Andy Wilkinson 652401b76c Polish message converter references relating to Jackson 3 upgrade
See gh-45535
2025-09-10 15:23:22 +01:00
Phillip Webb 239f384ac0 Update PropertyMapper to better support nullability
Refactor `PropertyMapper` so that it no longer calls adapter or
predicate methods by default when the source value is `null`. This
effectively makes all default calls the same as using
`alwaysWhenNotNull` in the previous generation of the code.

For the limited times when you do need to deal with `null` values, the
new `always()` method can be used.

For example,

	map.from(source::method).to(destination::method);

Will not call `destination.method(...)` if `source.method()` returns
`null`.

Where as:

	map.from(source::method).always().to(destination::method);

Will call  `destination.method(null)` if `source.method()` returns
`null`.

This update provides clearer semantics for the API and allows for better
JSpecify nullability annotations. It has also simplified much of our
existing property mapper code.

Closes gh-47024

Co-authored-by: Moritz Halbritter <moritz.halbritter@broadcom.com>
2025-09-05 14:43:33 -07:00
Andy Wilkinson d353038c58 Update Jackson support to require Jackson 3
Closes gh-45535
2025-09-02 11:37:09 +01:00
Andy Wilkinson 8bfb170ebc Remove support for Jersey
Spring Boot 4 requires Jakarta EE 11. Jersey 4 will support EE 11 but
its release schedule is uncertain. Furthermore, Jersey does not yet
support Jackson 3 and there's no clear timeline for when Jackson 3
will be supported.

In light of the above, this commit removes support for Jersey.
Reinstating support can be considered once there's a Jersey GA that
supports Jakarta EE 11 or its clear that one will be available in
time for Boot's GA in November. Ideally, support for Jackson 3 would
also be available before reinstating Jersey support.

Closes gh-47017
2025-09-02 11:36:52 +01:00
Moritz Halbritter 303d4910bd Improve null-safety of module/spring-boot-webmvc
See gh-46926
2025-08-26 14:22:57 +02:00
Phillip Webb 7140be8751 Rename metrics, observation, and tracing modules
Rename modules to include 'micrometer'.

Closes gh-46925
2025-08-20 16:05:11 -07:00
Brian Clozel 8c0051a02e Drop Undertow support
Spring Framework 7.0 requires a Servlet 6.1 baseline for Servlet containers.

Partial Servlet 6.1 support is available on the `main` Undertow branch,
but there isn't any milestone version available for the undertow 2.4
generation. At this stage of our 4.0 schedule, we think it's safer to drop
Undertow support now.

Closes: gh-46917
2025-08-20 09:30:40 +02:00
Moritz Halbritter 279258f699 Add nullability annotations to module/spring-boot-webmvc
See gh-46587
2025-08-07 10:48:44 +02:00
Phillip Webb dba148ea37 Adapt to upstream API version updates
Closes gh-46519
2025-07-31 17:51:44 +01:00
Phillip Webb 707388beff Add API versioning auto-configuration and properties support
Update `RestClient`, `WebClient`, Spring MVC and Spring WebFlux
auto-configuration to support API versioning.

Closes gh-46519
2025-07-30 15:58:23 +01:00
Moritz Halbritter c0f1f641ce Make auto-configurations final and remove public members
Closes gh-32883
2025-07-29 09:48:49 +02:00
Phillip Webb decc32dde3 Restructure project directories to better fit Gradle
Closes gh-46358
2025-07-10 17:54:08 -07:00