Skip to content

[BUG] [JAVA] [Restclient] ApiClient incompatible with Spring Framework 7 HttpHeaders #21628

@typat

Description

@typat
Description

Spring Framework 7 removed several methods from the HttpHeaders class. The generated ApiClient template uses removed methods (containsKey and entrySet) that have been removed in favor of new methods (containsHeader and headerSet).

spring-projects/spring-framework#33913

https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-7.0-Release-Notes#httpheaders-changes

openapi-generator version

7.14.0

OpenAPI declaration file content or url

https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/Java/libraries/restclient/ApiClient.mustache#L362

https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/Java/libraries/restclient/ApiClient.mustache#L715

Generation Details

Spring Framework 7.0.0-M7 or Spring Boot 4.0.0-M1

generatorName = "java"
library = "restclient"
Suggest a fix

headerSet() exists as of Spring Framework 6.1.15 but containsHeader was added with Spring Framework 7.0, and unfortunately at this time there is no fallback or intermediate solution, and likely a new generation option for using Spring Framework 7 or Spring Boot 4 might be necessary.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions