Commit Graph
41 Commits
Author SHA1 Message Date
Stéphane Nicoll 3959c56bdd Deprecate RestTemplate support
With Spring Framework 7.1 deprecating RestTemplate for removal, this
commit deprecates our supporting infrastructure as well, and steers
users towards RestClient instead:

* RestTemplateAutoConfiguration and
  RestTemplateObservationAutoConfiguration
* RestTemplateBuilder, RestTemplateBuilderConfigurer, and
  RestTemplateBuilderClientHttpRequestInitializer
* RestTemplateCustomizer, RestTemplateRequestCustomizer, and
  ObservationRestTemplateCustomizer
* MockRestServiceServerAutoConfiguration,
  MockServerRestTemplateCustomizer, and RootUriRequestExpectationManager
  in the test support module

The reference documentation no longer covers RestTemplate and now
solely documents RestClient and WebClient. Code snippets and sample
tests that only existed to illustrate RestTemplate usage have been
removed accordingly.

Closes gh-51118
2026-07-25 08:32:32 +02:00
Andy Wilkinson 6a74bb85a3 Merge branch '4.0.x'
Closes gh-50440
2026-05-14 15:03:44 +01:00
Andy Wilkinson add52b6ccd Merge branch '3.5.x' into 4.0.x
Closes gh-50439
2026-05-14 15:02:24 +01:00
Andy Wilkinson 5721f57acd Polish "Update TestRestTemplate's default cookie handling to match RestTemplate's"
See gh-49261

Signed-off-by: Andy Wilkinson <andy.wilkinson@broadcom.com>
2026-03-12 13:05:21 +00:00
Apoorv Darshan 085d522570 Update TestRestTemplate's default cookie handling to match RestTemplate's
See gh-49261

Signed-off-by: Apoorv Darshan <ad13dtu@gmail.com>
2026-03-12 12:13:27 +00:00
Brian Clozel 4b11e04e78 Deprecate RestTemplateBuilder#rootUri with replacement
This commit deprecates both `RootUriTemplateHandler` and
`RootUriBuilderFactory` types, along their usage in places like
`RestTemplateBuilder`.

`RestTemplateBuilder#rootUri` is now deprecated in favor of
`RestTemplateBuilder#baseUri`, which leverages Framework's
`DefaultUriBuilderFactory`.

Closes gh-48350
2026-02-24 16:18:09 +01:00
Phillip Webb 1d054e8a12 Ensure HttpMessageConverters are configured before RestClients
Update `RestClientAutoConfiguration` to ensure that it applies after
`HttpMessageConvertersAutoConfiguration`.

Prior to this commit, the `HttpMessageConvertersRestClientCustomizer`
bean might not get created due to the `@ConditionalOnBean` guard not
finding any `ClientHttpMessageConvertersCustomizer` beans.

Since the issue is surprising hard to replicate in a unit test, a new
smoke test has been added to ensure the problem doesn't return.

Fixes gh-49223
2026-02-17 22:26:02 -08:00
Andy Wilkinson 9bd1a460a1 Correct packaging of test code
Closes gh-48699
2026-01-08 11:43:43 +00:00
Phillip Webb 70ce043f80 Bind HttpServiceClientProperties directly
Update `HttpServiceClientProperties` to use direct binding rather than
using `@ConfigurationProperties`. The prevents metadata and IDE issues
and also allows the class API to be simplified.

Closes gh-48616
2026-01-07 17:39:56 -08:00
Stéphane Nicoll 2c55ccfa7f Provide Micrometer's observation test with micrometer test modules
Closes gh-48386
2025-12-27 10:05:32 +01:00
Stéphane Nicoll 4feb1faf3a Polish "Relax conditions to create HttpService client with RestClient"
See gh-48274
2025-11-27 09:54:50 +01:00
Nhahan a2160f793b Relax conditions to create HttpService client with RestClient
Previously, HttpServiceClientAutoConfiguration used
NotReactiveWebApplicationCondition, which prevented
activation in reactive apps even when virtual threads
were enabled.

This commit removes the condition to follow suite with what was done in
gh-48308

See gh-48274

Signed-off-by: Nhahan <kisy324@naver.com>
2025-11-27 09:54:04 +01:00
Stéphane Nicoll 2336cddb1f Relax conditions to create RestClient infrastructure
Previously, the necessary infrastructure to create a RestClient was only
configured in a servlet-based application or in a reactive application
if virtual threads are enabled.

While this extra care was important in
Spring Boot 4 as the aut-configuration is always available, this is no
longer the case with Spring Boot 4. Indeed, an explicit module has to be
added to the classpath now.

This commit therefore relaxes the condition. If the module has been
added, then the infrastructure is auto-configured.

Closes gh-48308
2025-11-27 09:38:24 +01:00
Stéphane Nicoll 72eaeecd5c Allow other configures to run before PropertiesRestClientHttpServiceGroupConfigurer
Closes gh-48296
2025-11-26 16:06:24 +01:00
Stéphane Nicoll 00f60da0de Start building against Spring Framework 7.0.0 snapshots
See gh-47825
2025-11-11 10:22:06 +00:00
Phillip Webb 00bd0efc56 Merge branch '3.5.x'
Closes gh-47946
2025-11-04 15:36:55 -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
Andy Wilkinson aa95282290 Polish @since tags
Closes gh-47779
2025-10-23 12:48:58 +01:00
Phillip Webb 94199a63fa Change 'blocking' term to 'imperative'
Closes gh-47398
2025-10-15 13:11:10 -07:00
Moritz Halbritter b56d9c6b08 Add nullability annotations to tests in module/spring-boot-restclient
See gh-47263
2025-10-13 13:44:25 +02:00
Phillip Webb 02b2d03acf Rationalize HTTP client configuration properties
Simplify HTTP client configuration properties by sharing common
settings for both blocking and reactive clients.

The `ClientHttpRequestFactorySettings` and `ClientHttpConnectorSettings`
have been merged to a single `HttpClientSettings` class. Properties
to configure common settings are available under:

	`spring.http.clients`

Blocking and reactive settings have been moved to
`spring.http.clients.blocking` and `spring.http.clients.reactive`. With
currently only the factory/connector being configurable.

HTTP Service Client properties have also been rationalized under a
`spring.http.serviceclient.<group-name>`. Support for properties that
apply to all service clients and all Rest/Web Clients have been removed.

Support for `ApiVerionInserter` beans has also been removed in favor of
configuring the service group or builders directly.

Closes gh-47398
2025-10-09 22:18:53 -07:00
Andy WilkinsonandPhillip Webb 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 36732bd74a Polish 2025-10-01 17:21:00 -07:00
Stéphane Nicoll 787840735b Add support for RestTestClient
This commit adds support for RestTestClient for MockMvc and integration
tests.

Closes gh-47335
2025-10-01 09:04:59 +02:00
Phillip Webb 74a5d13fe9 Polish HTTP Service client auto-configuration 2025-09-16 09:08:34 -07:00
Andy Wilkinson d0c742bc7b Merge branch '3.5.x'
Closes gh-47146
2025-09-10 12:51:51 +01:00
Stéphane Nicoll 6207e41473 Remove auto-configuration support for '@HttpServiceClient'
This reverts commit 7a8b337b1c.

Closes gh-47123
2025-09-08 16:13:38 +02:00
Phillip WebbandMoritz Halbritter 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
Moritz Halbritter bab9cdb47f Improve null-safety of module/spring-boot-restclient
See gh-46926
2025-08-27 14:20:11 +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
Phillip Webb d307d57617 Apply HTTP Service Client properties and use fallback beans
Update service client configuration so that properties are always
applied when present. Any settings and factory/connector beans that
are present are now only used as fallbacks.

Fixes gh-46915
2025-08-19 17:21:22 -07:00
Phillip Webb 7a8b337b1c Add @HttpServiceClient scanning auto-configuration
Refactor `HttpServiceClientAutoConfiguration` and
`ReactiveHttpServiceClientAutoConfiguration` to support scanning for
`@HttpServiceClient` annotated interfaces.

Closes gh-46782
2025-08-15 18:48:38 -07:00
Moritz Halbritter 9918abfa99 Add nullability annotations to module/spring-boot-restclient
See gh-46587
2025-08-05 10:03:40 +02: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
Stéphane Nicoll fcbb03a52a Add mising configurations in spring-boot-docs
Closes gh-46536
2025-07-28 16:44:04 +02:00
Phillip Webb 5e90415880 Rationalize starters following modularization
Update dependencies and starters following modularization. New
starters have been added for each user-facing module.

Closes gh-46245
2025-07-22 18:27:27 +01:00
Stéphane Nicoll 0efe9c271b Temporarily suppress deprecation in message converters customization 2025-07-14 10:06:16 +02:00
Andy Wilkinson 94215d3fdc Move Threading enum from spring-boot-autoconfigure to spring-boot
The enum itself is not specifically tied to auto-configuration so
spring-boot is a better place for it. The related condition,
`@ConditionalOnThreading`, remains in spring-boot-autoconfigure. This
aligns things with the similar `CloudPlatform` and
`@ConditionalOnCloudPlatform`.

Closes gh-46406
2025-07-11 13:49:41 +01:00
Phillip Webb decc32dde3 Restructure project directories to better fit Gradle
Closes gh-46358
2025-07-10 17:54:08 -07:00