Skip to content

javax.servlet is still used even when "jakarta" is set to true #1167

Description

@tgillain

Hello,

We are currently migrating our project from springboot 2.7.x to 3.0.x.
When using the plugin configuration below that used to work with spring 2.7.x and adding true, the generated ***Api.java is still containing a reference to import javax.servlet.http.HttpServletRequest;

I manage to make it work by slightly changing the src/main/resources/handlebars/JavaSpring/api.mustache to also take into account the 'jakarta' parameter.

Could you please indicate if I am doing something wrong or if I can contribute to the project by pushing this change ?

Brs.
Th.

The proposed change :
{{#jdk8-no-delegate}} {{#jakarta}} import jakarta.servlet.http.HttpServletRequest; {{/jakarta}} {{^jakarta}} import javax.servlet.http.HttpServletRequest; {{/jakarta}} {{/jdk8-no-delegate}}

The used plugin configuration :
<plugin> <groupId>io.swagger.codegen.v3</groupId> <artifactId>swagger-codegen-maven-plugin</artifactId> <version>1.0.46</version> <executions> <execution> <goals> <goal>generate</goal> </goals> <configuration> <inputSpec>${open-api-spec}</inputSpec> <language>spring</language> <apiPackage>${apipackage}</apiPackage> <modelPackage>${modelPackage}</modelPackage> <generateApiTests>false</generateApiTests> <configOptions> <java8>true</java8> <async>true</async> <interfaceOnly>true</interfaceOnly> <jakarta>true</jakarta> </configOptions> </configuration> </execution> </executions> </plugin>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions