Search code examples
spring-bootresttemplatespring-oauth2

What is the minimum spring boot version that is compatible with the RestTemplate that has security configuration?


So we know that in SpringBoot 3.0.x the OAuth2RestTemplate gets deprecated, making a lot of folks use WebClient as a means of making API calls with Security

However, the RestTemplate (import org.springframework.web.client.RestTemplate;) library itself (note that WebClient is from reactive and different from the web.client you see in that import statement) was updated to include integrated security.

What do I mean by integrated security? A lot of folks used to have one RestTemplate fetch tokens and another to make API calls. Ingrated Security means one RestTemplate can do both (via Security configuration)

I tried migrating to Spring Boot 3.0.1 from 2.5.14 but the amount of breaking changes begs the question: need I only bump up to, say, 2.7


Solution

  • The answer surprisingly is version 2.5.14

    So code-wise, one would put: The build.gradle of the consuming app:

    plugins {
        ...
        id 'org.springframework.boot' version '2.5.14'
    }
    

    The build.gradle of the starter:

    dependencies {
       ...
       implementation platform('org.springframework.boot:spring-boot-dependencies:2.5.14')
    }