diff --git a/docs/generators/java-camel.md b/docs/generators/java-camel.md index a94365bc153..ae510a1033d 100644 --- a/docs/generators/java-camel.md +++ b/docs/generators/java-camel.md @@ -95,7 +95,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useFeignClientUrl|Whether to generate Feign client with url parameter.| |true| |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useOptional|Use Optional container for optional parameters| |false| -|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports).| |false| +|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.| |false| |useSpringController|Annotate the generated API as a Spring Controller| |false| |useSwaggerUI|Open the OpenApi specification in swagger-ui. Will also import and configure needed dependencies| |true| |useTags|use tags for creating interface and controller classnames| |false| diff --git a/docs/generators/spring.md b/docs/generators/spring.md index 3b3a7ca1b5b..ad6cba9fa6f 100644 --- a/docs/generators/spring.md +++ b/docs/generators/spring.md @@ -88,7 +88,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useFeignClientUrl|Whether to generate Feign client with url parameter.| |true| |useJakartaEe|whether to use Jakarta EE namespace instead of javax| |false| |useOptional|Use Optional container for optional parameters| |false| -|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports).| |false| +|useSpringBoot3|Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.| |false| |useSpringController|Annotate the generated API as a Spring Controller| |false| |useSwaggerUI|Open the OpenApi specification in swagger-ui. Will also import and configure needed dependencies| |true| |useTags|use tags for creating interface and controller classnames| |false| diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java index 4e8fb146c0a..4d37bc7141d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java @@ -241,7 +241,7 @@ public class SpringCodegen extends AbstractJavaCodegen "Open the OpenApi specification in swagger-ui. Will also import and configure needed dependencies", useSwaggerUI)); cliOptions.add(CliOption.newBoolean(USE_SPRING_BOOT3, - "Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports).", + "Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports). Enabling this option will also enable `useJakartaEe`.", useSpringBoot3)); supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application."); @@ -473,6 +473,8 @@ public class SpringCodegen extends AbstractJavaCodegen if (AnnotationLibrary.SWAGGER1.equals(getAnnotationLibrary())) { throw new IllegalArgumentException(AnnotationLibrary.SWAGGER1.getPropertyName() + " is not supported with Spring Boot > 3.x"); } + useJakartaEe=true; + additionalProperties.put(USE_JAKARTA_EE, useJakartaEe); applyJakartaPackage(); } writePropertyBack(USE_SPRING_BOOT3, isUseSpringBoot3());