quarkusio/quarkus · error · IllegalArgumentException
spEL expressions are not currently supported. Offending meth
Error message
spEL expressions are not currently supported. Offending method is ${methodName} of Repository ${repositoryName} What it means
Spring Data JPA @Query annotations may contain SpEL (Spring Expression Language) expressions delimited by #{...}. Quarkus's Spring Data JPA compatibility layer does not implement SpEL evaluation, so at build time it rejects such queries with this IllegalArgumentException. The build fails because the query string cannot be processed without Spring's expression machinery.
Source
Thrown at extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/CustomQueryMethodsAdder.java:105
AnnotationInstance queryInstance = method.annotation(DotNames.SPRING_DATA_QUERY);
AnnotationInstance namedQueryInstance = getNamedQueryForMethod(method, entityClassInfo);
String methodName = method.name();
String repositoryName = repositoryClassInfo.name().toString();
String queryString;
if (queryInstance != null) {
verifyQueryAnnotation(queryInstance, methodName, repositoryName);
queryString = queryInstance.value(QUERY_VALUE_FIELD).asString().trim();
} else if (namedQueryInstance != null) {
queryString = namedQueryInstance.value(NAMED_QUERY_FIELD).asString().trim();
} else {
// handled by DerivedMethodsAdder
continue;
}
if (queryString.contains("#{")) {
throw new IllegalArgumentException("spEL expressions are not currently supported. " +
"Offending method is " + methodName + " of Repository " + repositoryName);
}
if (!(queryString.startsWith("select") || queryString.startsWith("SELECT")
|| queryString.startsWith("from") || queryString.startsWith("FROM")
|| queryString.startsWith("delete") || queryString.startsWith("DELETE")
|| queryString.startsWith("update") || queryString.startsWith("UPDATE"))) {
throw new IllegalArgumentException("Unsupported query type in @Query. " +
"Offending method is " + methodName + " of Repository " + repositoryName);
}
List<Type> methodParameterTypes = method.parameterTypes();
String[] methodParameterTypesStr = new String[methodParameterTypes.size()];
List<Integer> queryParameterIndexes = new ArrayList<>(methodParameterTypes.size());
Integer pageableParameterIndex = null;
Integer sortParameterIndex = null;
for (int i = 0; i < methodParameterTypes.size(); i++) {
DotName parameterType = methodParameterTypes.get(i).name();View on GitHub (pinned to e1c734241f)
Solutions
- Rewrite the query without SpEL: inline the entity name and replace SpEL parameter references with standard :namedParameter syntax
- Remove #{#entityName} and write the entity class name directly in the query
- Use derived query methods (findBy...) instead of custom queries where possible
- If SpEL is essential, use plain Spring Data JPA (Spring Boot) instead of the Quarkus compatibility layer
Example fix
// before
@Query("select u from #{#entityName} u where u.name = :n")
List<User> findByName(@Param("n") String n);
// after
@Query("select u from User u where u.name = :n")
List<User> findByName(@Param("n") String n); Defensive patterns
Strategy: validation
Validate before calling
// Reject SpEL before porting the query
if (query != null && query.contains("#{")) {
throw new IllegalArgumentException("Replace SpEL " + query + " with plain JPQL");
} Try / catch
try {
compile();
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("spEL expressions are not currently supported")) {
log.error("Rewrite query without #{} expressions");
}
throw e;
} Prevention
- Never use #{...} in @Query values on Quarkus
- Replace #{#entityName} with the literal entity class name
- Use derived query methods when dynamic behavior comes from SpEL
- Search migrated Spring code for '#{' before building
When it happens
Trigger: Annotating a repository method with @Query whose value contains a SpEL expression such as #{#entityName}, #{#n}, or any other #{...} construct.
Common situations: Porting an existing Spring Boot application to Quarkus where queries used SpEL for dynamic entity names or parameter references; copy-pasting queries from Spring documentation that rely on #{#entityName}.
Related errors
- Method ${repositoryMethodDescription} cannot be parsed. Did
- Return type of method ${methodName} of Repository ${reposito
- ${t.name()} is not in the Quarkus Jandex index and cannot be
- Unsupported query type in @Query. Offending method is ${meth
- ${method.name()} of Repository ${repositoryClassInfo} is mea
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/86849e5d638d4eca.
Report an issue: GitHub.