quarkusio/quarkus · error · IllegalArgumentException
SpEL expressions are not supported when using @org.springfra
Error message
SpEL expressions are not supported when using @org.springframework.beans.factory.annotation.Value. Offending value is '<annotation>'
What it means
Quarkus's Spring DI compatibility layer translates Spring's @Value annotation into Quarkus config injection. Spring Expression Language (SpEL) expressions cannot be translated to Quarkus config properties, so the processor rejects any @Value value containing the SpEL start marker '#{' at build time.
Source
Thrown at extensions/spring-di/deployment/src/main/java/io/quarkus/spring/di/deployment/SpringDIProcessor.java:579
char[] chars = name.toCharArray();
chars[0] = Character.toLowerCase(chars[0]);
return new String(chars);
}
} else {
return name;
}
}
private void addSpringValueAnnotations(AnnotationTarget target, AnnotationInstance annotation, boolean addInject,
Set<AnnotationInstance> annotationsToAdd) {
final AnnotationValue annotationValue = annotation.value();
if (annotationValue == null) {
return;
}
String defaultValue = null;
String stringValue = annotationValue.asString();
if (stringValue.contains("#{")) {
throw new IllegalArgumentException(
"SpEL expressions are not supported when using " + SPRING_VALUE_ANNOTATION + ". Offending value is '"
+ annotation + "'");
}
String propertyName = stringValue.replace("${", "").replace("}", "");
if (propertyName.contains(":")) {
final int index = propertyName.indexOf(':');
if (index < propertyName.length() - 1) {
defaultValue = propertyName.substring(index + 1);
}
propertyName = propertyName.substring(0, index);
}
final List<AnnotationValue> annotationValues = new ArrayList<>();
annotationValues.add(AnnotationValue.createStringValue("name", propertyName));
if (defaultValue != null && !defaultValue.isEmpty()) {
annotationValues.add(AnnotationValue.createStringValue("defaultValue", defaultValue));
}
annotationsToAdd.add(create(View on GitHub (pinned to e1c734241f)
Solutions
- Replace the SpEL expression with a plain config property: @Value("${my.property}") or @ConfigProperty(name="my.property")
- Move the SpEL logic into a @PostConstruct init method or a producer method in Java code
- Use Quarkus SmallRye Config features (defaults, property expansion in application.properties) instead of SpEL
- For bean-value lookups, inject the bean directly instead of via SpEL
Example fix
// before
@Value("#{systemProperties['greeting'] ?: 'hello'}")
private String greeting;
// after
@ConfigProperty(name = "greeting", defaultValue = "hello")
private String greeting; Defensive patterns
Strategy: validation
Validate before calling
// before build, scan @Value values
String v = annotationValue;
if (v != null && v.contains("#{")) {
throw new IllegalStateException("SpEL not supported in @Value: " + v);
} Prevention
- Never use #{ in @Value values; only ${prop} placeholders
- Grep the codebase for '@Value("#{' during Spring-to-Quarkus migration
- Prefer @ConfigProperty (SmallRye) for config injection in Quarkus
When it happens
Trigger: Using @Value("#{...}") with a SpEL expression (e.g. #{systemProperties['x']}, #{otherBean.field}, #{... + ...}) on a bean field, constructor param, or method param in a Spring-style bean processed by the spring-di extension.
Common situations: Migrating an existing Spring Boot app to Quarkus where @Value was used for SpEL-driven defaults, bean-to-bean lookups, or property concatenation; copying Spring examples that use SpEL into Quarkus.
Related errors
- spEL expressions are not currently supported. Offending meth
- AnnotationInstance ${instance} is an invalid target. Only Cl
- AnnotationInstance <annotationInstance> is an invalid target
- Failed to open path tree with root %s
- Dev services for ${request.getName()} requires a startable s
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/7208c7e69e52a9bd.
Report an issue: GitHub.