quarkusio/quarkus · error · IllegalArgumentException
Unsupported annotation target kind
Error message
Unsupported annotation target kind
What it means
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>'.
Source
Thrown at extensions/spring-boot-properties/deployment/src/main/java/io/quarkus/spring/boot/properties/deployment/ConfigurationPropertiesProcessor.java:73
boolean ignoreMismatching = true;
AnnotationValue ignoreUnknownFieldsValue = annotation.value("ignoreUnknownFields");
if (ignoreUnknownFieldsValue != null) {
ignoreMismatching = ignoreUnknownFieldsValue.asBoolean();
}
switch (annotation.target().kind()) {
case CLASS:
metadata.add(
new ConfigurationPropertiesMetadataBuildItem(annotation.target().asClass(), getPrefix(annotation),
namingStrategy, !ignoreMismatching));
break;
case METHOD:
onMethodInstances.add(annotation.target().asMethod());
metadata.add(new ConfigurationPropertiesMetadataBuildItem(
index.getClassByName(annotation.target().asMethod().returnType().name()), getPrefix(annotation),
namingStrategy, !ignoreMismatching, ArcInstanceFactory.INSTANCE));
break;
default:
throw new IllegalArgumentException(
"Unsupported annotation target kind " + annotation.target().kind().name());
}
}
if (!onMethodInstances.isEmpty()) {
// the idea here is to transform the producer to add a special qualifier that will then be
// used by the generated code in order to obtain the instance of the class
transformerProducer.produce(new AnnotationsTransformerBuildItem(new AnnotationsTransformer() {
@Override
public boolean appliesTo(AnnotationTarget.Kind kind) {
return kind == AnnotationTarget.Kind.METHOD;
}
@Override
public void transform(TransformationContext transformationContext) {
Collection<AnnotationInstance> instances = transformationContext.getAnnotations();
boolean matches = false;View on GitHub (pinned to e1c734241f)
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.
Example fix
// before
public class App {
@ConfigurationProperties(prefix = "app")
private AppProps props; // unsupported target
}
// after
@ConfigurationProperties(prefix = "app")
public class AppProps { ... } Defensive patterns
Strategy: validation
Validate before calling
// verify @ConfigurationProperties is only on classes or @Produces methods
class App {
// INVALID: @ConfigurationProperties on a field
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Name cannot start with '/':${name}
- messageStarts cannot be empty
- 'target' can only be a class, a field or a method: <target>
- Unsupported target:
- Unsupported object of type ${object.getClass()}. Supported t
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/f23e7cbbf4f5a66d.
Report an issue: GitHub.