OpenAPITools/openapi-generator · error · IllegalArgumentException

useJackson3 is only available with Spring Boot >= 4

Error message

useJackson3 is only available with Spring Boot >= 4

What it means

Thrown when useJackson3=true but useSpringBoot4 is false. Jackson 3 lives under tools.jackson.* packages and is only on the classpath of Spring Boot 4; earlier Boot versions ship Jackson 2 (com.fasterxml.*). The generator will not emit Jackson 3 imports against a Boot 2/3 project.

Source

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

            }
            if (!isUseSpringBoot4()) {
                throw new IllegalArgumentException(CLIENT_REGISTRATION_ID + " requires " + USE_SPRING_BOOT4 + "=true because @ClientRegistrationId is provided by Spring Security 7");
            }
        }
        if (useSpringSecurityPreAuthorize && !SPRING_BOOT.equals(library)) {
            throw new IllegalArgumentException(USE_SPRING_SECURITY_PRE_AUTHORIZE
                    + " is only supported with the " + SPRING_BOOT + " library");
        }

        if (isUseSpringBoot3() || isUseSpringBoot4()) {
            if (AnnotationLibrary.SWAGGER1.equals(getAnnotationLibrary())) {
                throw new IllegalArgumentException(AnnotationLibrary.SWAGGER1.getPropertyName() + " is not supported with Spring Boot > 3.x");
            }
            useJakartaEe = true;
            applyJakartaPackage();
        }
        if(isUseJackson3() && !isUseSpringBoot4()){
            throw new IllegalArgumentException("useJackson3 is only available with Spring Boot >= 4");
        }
        if(this.useJackson3){
            this.applyJackson3Package();
        } else {
            this.applyJackson2Package();
        }

        convertPropertyToStringAndWriteBack(RESOURCE_FOLDER, this::setResourceFolder);
        convertPropertyToBooleanAndWriteBack(USE_HTTP_SERVICE_PROXY_FACTORY_INTERFACES_CONFIGURATOR, this::setUseHttpServiceProxyFactoryInterfacesConfigurator);

        convertPropertyToBooleanAndWriteBack(ADDITIONAL_NOT_NULL_ANNOTATIONS, this::setAdditionalNotNullAnnotations);

        convertPropertyToBooleanAndWriteBack(SUBSTITUTE_GENERIC_PAGED_MODEL, this::setSubstituteGenericPagedModel);
        convertPropertyToBooleanAndWriteBack(CodegenConstants.USE_ENUM_VALUE_INTERFACE, this::setUseEnumValueInterface);

        if (SPRING_BOOT.equals(library)) {
            convertPropertyToBooleanAndWriteBack(AUTO_X_SPRING_PAGINATED, this::setAutoXSpringPaginated);
            convertPropertyToBooleanAndWriteBack(GENERATE_SORT_VALIDATION, this::setGenerateSortValidation);

View on GitHub (pinned to fcec517be3)

Solutions

  1. Add -DuseSpringBoot4=true when enabling useJackson3.
  2. Or remove useJackson3 to stay on Jackson 2 with Boot 2/3 until the project upgrades.

Example fix

# before
-DuseSpringBoot3=true -DuseJackson3=true

# after
-DuseSpringBoot4=true -DuseJackson3=true
Defensive patterns

Strategy: validation

Validate before calling

# bash
if [ "$USE_JACKSON3" = "true" ] && [ "$USE_SPRING_BOOT4" != "true" ]; then
  echo "useJackson3 requires useSpringBoot4=true" >&2; exit 1
fi

Try / catch

// Java
try {
    new DefaultGenerator().opts(input).generate();
} catch (IllegalArgumentException e) {
    // message names the conflicting option; align jackson/Boot flags and rerun
}

Prevention

When it happens

Trigger: -DuseJackson3=true without -DuseSpringBoot4=true. Note that useSpringBoot3=true alone does not satisfy the check.

Common situations: Migrating to Jackson 3 for virtual-thread / null-handling improvements while the project is still on Boot 3; enabling useJackson3 because a dependency uses Jackson 3 without realising the generator ties it to Boot 4.

Related errors


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