{"record":{"id":"2eded2f8e71e2be5","repo":"OpenAPITools/openapi-generator","slug":"library-spring-http-interface-is-only-supported","errorCode":null,"errorMessage":"Library 'spring-http-interface' is only supported with Spring Boot 3 or 4","messagePattern":"Library 'spring-http-interface' is only supported with Spring Boot 3 or 4","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java","lineNumber":780,"sourceCode":"            } else if (SPRING_BOOT.equals(library)) {\n                apiTemplateFiles.put(\"apiController.mustache\", \"Controller.java\");\n                supportingFiles.add(new SupportingFile(\"application.mustache\",\n                        (\"src.main.resources\").replace(\".\", java.io.File.separator), \"application.properties\"));\n                supportingFiles.add(new SupportingFile(\"homeController.mustache\",\n                        (sourceFolder + File.separator + configPackage).replace(\".\", java.io.File.separator),\n                        \"HomeController.java\"));\n                supportingFiles.add(new SupportingFile(\"openapi.mustache\",\n                        (\"src/main/resources\").replace(\"/\", java.io.File.separator), \"openapi.yaml\"));\n                if (!reactive && !apiFirst) {\n                    if (DocumentationProvider.SPRINGDOC.equals(getDocumentationProvider())) {\n                        supportingFiles.add(new SupportingFile(\"springdocDocumentationConfig.mustache\",\n                                (sourceFolder + File.separator + configPackage).replace(\".\", java.io.File.separator),\n                                \"SpringDocConfiguration.java\"));\n                    }\n                }\n            } else if (SPRING_HTTP_INTERFACE.equals(library)) {\n                if (!(isUseSpringBoot3() || isUseSpringBoot4())) {\n                    throw new IllegalArgumentException(\"Library '\" + SPRING_HTTP_INTERFACE + \"' is only supported with Spring Boot 3 or 4\");\n                }\n\n                String httpInterfacesAbstractConfiguratorFile = useHttpServiceProxyFactoryInterfacesConfigurator ?\n                    \"httpServiceProxyFactoryInterfacesConfigurator.mustache\" :\n                    \"httpInterfacesConfiguration.mustache\";\n\n                supportingFiles.add(new SupportingFile(httpInterfacesAbstractConfiguratorFile,\n                        (sourceFolder + File.separator + configPackage).replace(\".\", java.io.File.separator), \"HttpInterfacesAbstractConfigurator.java\"));\n\n                writePropertyBack(HTTP_INTERFACES_CONFIGURATOR_DEPENDENCY,\n                    useHttpServiceProxyFactoryInterfacesConfigurator ?\n                    \"HttpServiceProxyFactory\" :\n                    reactive ? \"WebClient\" : \"RestClient\"\n                );\n            }\n        }\n\n        if (SPRING_BOOT.equals(library)) {","sourceCodeStart":762,"sourceCodeEnd":798,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java#L762-L798","documentation":"The spring-http-interface library generates clients built on Spring's declarative HTTP interfaces (@HttpExchange proxies), which exist only in Spring Framework 6 (Boot 3) and later. During supporting-file setup the generator throws when neither useSpringBoot3 nor useSpringBoot4 is enabled, because the required framework APIs are absent from older Boot versions.","triggerScenarios":"-g spring --library=spring-http-interface with neither -DuseSpringBoot3=true nor -DuseSpringBoot4=true.","commonSituations":"Using the generator defaults (no Boot flag) with this library; Spring Boot 2 projects trying the new client style; the Boot flag getting lost when a config moves from CLI to Maven plugin or between CI jobs.","solutions":["Add -DuseSpringBoot3=true or -DuseSpringBoot4=true to the generation command.","If you must stay on Spring Boot 2.x, switch to a client library that supports it (resttemplate, webclient)."],"exampleFix":"# before\nopenapi-generator generate -g spring -i api.yaml --library=spring-http-interface\n\n# after\nopenapi-generator generate -g spring -i api.yaml --library=spring-http-interface -DuseSpringBoot3=true","handlingStrategy":"validation","validationCode":"# bash\nif [ \"$LIBRARY\" = \"spring-http-interface\" ] \\\n   && [ \"$USE_SPRING_BOOT3\" != \"true\" ] && [ \"$USE_SPRING_BOOT4\" != \"true\" ]; then\n  echo \"spring-http-interface requires useSpringBoot3=true or useSpringBoot4=true\" >&2; exit 1\nfi","typeGuard":null,"tryCatchPattern":"// Java\ntry {\n    new DefaultGenerator().opts(input).generate();\n} catch (IllegalArgumentException e) {\n    // library/version mismatch: set a Boot flag in ClientOptInput and regenerate once\n}","preventionTips":["Store library + required Boot flag together as one named preset.","Validate generator options in a pre-flight script before the build runs generation.","After switching libraries, diff the full option set for leftovers."],"tags":["spring","configuration","openapi-generator"],"backgroundTag":"incompatible-generator-options","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}