{"record":{"id":"f23e7cbbf4f5a66d","repo":"quarkusio/quarkus","slug":"unsupported-annotation-target-kind","errorCode":null,"errorMessage":"Unsupported annotation target kind ","messagePattern":"Unsupported annotation target kind ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/spring-boot-properties/deployment/src/main/java/io/quarkus/spring/boot/properties/deployment/ConfigurationPropertiesProcessor.java","lineNumber":73,"sourceCode":"            boolean ignoreMismatching = true;\n            AnnotationValue ignoreUnknownFieldsValue = annotation.value(\"ignoreUnknownFields\");\n            if (ignoreUnknownFieldsValue != null) {\n                ignoreMismatching = ignoreUnknownFieldsValue.asBoolean();\n            }\n            switch (annotation.target().kind()) {\n                case CLASS:\n                    metadata.add(\n                            new ConfigurationPropertiesMetadataBuildItem(annotation.target().asClass(), getPrefix(annotation),\n                                    namingStrategy, !ignoreMismatching));\n                    break;\n                case METHOD:\n                    onMethodInstances.add(annotation.target().asMethod());\n                    metadata.add(new ConfigurationPropertiesMetadataBuildItem(\n                            index.getClassByName(annotation.target().asMethod().returnType().name()), getPrefix(annotation),\n                            namingStrategy, !ignoreMismatching, ArcInstanceFactory.INSTANCE));\n                    break;\n                default:\n                    throw new IllegalArgumentException(\n                            \"Unsupported annotation target kind \" + annotation.target().kind().name());\n            }\n        }\n\n        if (!onMethodInstances.isEmpty()) {\n            // the idea here is to transform the producer to add a special qualifier that will then be\n            // used by the generated code in order to obtain the instance of the class\n            transformerProducer.produce(new AnnotationsTransformerBuildItem(new AnnotationsTransformer() {\n\n                @Override\n                public boolean appliesTo(AnnotationTarget.Kind kind) {\n                    return kind == AnnotationTarget.Kind.METHOD;\n                }\n\n                @Override\n                public void transform(TransformationContext transformationContext) {\n                    Collection<AnnotationInstance> instances = transformationContext.getAnnotations();\n                    boolean matches = false;","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/spring-boot-properties/deployment/src/main/java/io/quarkus/spring/boot/properties/deployment/ConfigurationPropertiesProcessor.java#L55-L91","documentation":"The ConfigurationPropertiesProcessor scans the application index for Spring @ConfigurationProperties annotations. It handles targets on classes and methods (@Produces), but if the annotation appears on another target kind (field, parameter, etc.) the default branch throws IllegalArgumentException 'Unsupported annotation target kind <kind>'.","triggerScenarios":"Placing @ConfigurationProperties on an annotation target Quarkus does not support — e.g. on a field or a constructor parameter — instead of on a class or on a @Produces method; raised in produceConfigPropertiesMetadata while iterating indexed annotation instances.","commonSituations":"Annotating a field because Spring also allows constructor binding there; IDE auto-import placing the annotation on the wrong element; copying code from a Spring Boot project where field placement worked.","solutions":["Move @ConfigurationProperties onto the class declaration (the supported style).","Alternatively place it on a @Produces producer method that returns the config class.","Remove the annotation from fields/parameters where it is invalid."],"exampleFix":"// before\npublic class App {\n    @ConfigurationProperties(prefix = \"app\")\n    private AppProps props; // unsupported target\n}\n\n// after\n@ConfigurationProperties(prefix = \"app\")\npublic class AppProps { ... }","handlingStrategy":"validation","validationCode":"// verify @ConfigurationProperties is only on classes or @Produces methods\nclass App {\n  // INVALID: @ConfigurationProperties on a field\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only annotate top-level classes or @Produces producer methods with @ConfigurationProperties","Never place the annotation on fields or parameters","Rely on IDE/compile checks from quarkus-spring-boot-properties early in development"],"tags":["quarkus","build-time","annotation-target","illegal-argument"],"backgroundTag":"invalid-annotation-target","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}