System SSL certificates are not used by the Apache HTTP Client in a RestTemplate built with RestTemplateBuilder #38591
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With this change, the SSL certificates that are provided by the system are picked up by default when using the
RestTemplateBuilder
.This aligns with the implementation of
new RestTemplate()
which is already doing this, and can be considered a follow-up to a previous (partial) fix from 5 months ago relating to this issue.(For context,
RestTemplate
is usingSimpleClientHttpRequestFactory
by default, which appears to be picking up the SSL certificates from the environment)In our Cloud Foundry environment, where the SSL certificates are provided by the system through a build-pack, we encountered a problem with SSL certificates. The SSL certificates from the system work fine with
new RestTemplate()
, but not withnew RestTemplateBuilder.build()
. This seems unintentional, especially considering a previous (partial) fix that added some functionality (throughuseSystemProperties()
) but missed the SSL properties.As I am quite new to the Java & Spring Boot ecosystem I am not entirely sure how to best test this, but the issue we are facing seems to be a spring-boot issue to me, which can hopefully be fixed with my PR.