OpenAPITools/openapi-generator · error · IllegalArgumentException

useJackson3 for the restclient, resttemplate, and webclient

Error message

useJackson3 for the restclient, resttemplate, and webclient libraries requires useSpringBoot4=true

What it means

Error "useJackson3 for the restclient, resttemplate, and webclient libraries requires useSpringBoot4=true" thrown in OpenAPITools/openapi-generator.

Source

Thrown at modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java:409

        final boolean libMicroprofile = isLibrary(MICROPROFILE);
        final boolean libNative = isLibrary(NATIVE);
        final boolean libOkHttpGson = isLibrary(OKHTTP_GSON) || StringUtils.isBlank(getLibrary());
        final boolean libRestAssured = isLibrary(REST_ASSURED);
        final boolean libRestClient = isLibrary(RESTCLIENT);
        final boolean libRestEasy = isLibrary(RESTEASY);
        final boolean libRestTemplate = isLibrary(RESTTEMPLATE);
        final boolean libRetrofit2 = isLibrary(RETROFIT_2);
        final boolean libVertx = isLibrary(VERTX);
        final boolean libWebClient = isLibrary(WEBCLIENT);

        // default jackson unless overridden by setSerializationLibrary
        this.jackson = !additionalProperties.containsKey(CodegenConstants.SERIALIZATION_LIBRARY) ||
                SERIALIZATION_LIBRARY_JACKSON.equals(additionalProperties.get(CodegenConstants.SERIALIZATION_LIBRARY));
        convertPropertyToBooleanAndWriteBack(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, this::setUseOneOfDiscriminatorLookup);
        convertPropertyToBooleanAndWriteBack(USE_JACKSON_3, this::setUseJackson3);
        convertPropertyToBooleanAndWriteBack(USE_SPRING_BOOT4, this::setUseSpringBoot4);
        if (useJackson3 && (libRestClient || libRestTemplate || libWebClient) && !useSpringBoot4) {
            throw new IllegalArgumentException("useJackson3 for the restclient, resttemplate, and webclient libraries requires useSpringBoot4=true");
        } else if (useJackson3 && !libNative && !libApache && !libJersey3 && !libRestClient && !libRestTemplate && !libWebClient) {
            throw new IllegalArgumentException("useJackson3 is only supported for the 'native', 'apache-httpclient', 'jersey3', 'restclient', 'resttemplate', and 'webclient' libraries. " +
                    "The Spring libraries also require useSpringBoot4=true.");
        }

        if (this.useJackson3) {
            this.applyJackson3Package();
        } else {
            this.applyJackson2Package();
        }

        if(this.useSpringBoot4) {
            setUseJakartaEe(true);
            applyJakartaPackage();
        }

        // override parent one
        importMapping.put("JsonDeserialize", (useJackson3 ? JACKSON3_PACKAGE : JACKSON2_PACKAGE) + ".databind.annotation.JsonDeserialize");

View on GitHub (pinned to fcec517be3)

Solutions

  1. When using useJackson3 with the restclient, resttemplate or webclient library, also set useSpringBoot4=true.

When it happens

Trigger: Thrown when useJackson3=true is set for the Java client generator with the restclient, resttemplate, or webclient library without also setting useSpringBoot4=true. Add --additional-properties useSpringBoot4=true.

Common situations: See trigger scenarios.


AI-assisted analysis of OpenAPITools/openapi-generator@fcec517be3 (2026-08-22). Data as JSON: /api/errors/260b783d941648e9. Report an issue: GitHub.