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

  1. Replace the SpEL expression with a plain config property: @Value("${my.property}") or @ConfigProperty(name="my.property")
  2. Move the SpEL logic into a @PostConstruct init method or a producer method in Java code
  3. Use Quarkus SmallRye Config features (defaults, property expansion in application.properties) instead of SpEL
  4. 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

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


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/7208c7e69e52a9bd. Report an issue: GitHub.