quarkusio/quarkus · error · IllegalArgumentException

Method + method.name() + of interface + ifaceDotName + i

Error message

Method  + method.name() +  of interface  + ifaceDotName +  is not a getter method since it defined parameters

What it means

Interface-based @ConfigurationProperties in Quarkus require every non-default, non-static, non-private interface method to be a property getter. If a method declares parameters, generateImplementationForInterfaceConfigPropertiesRec throws IllegalArgumentException 'Method <name> of interface <iface> is not a getter method since it defined parameters'.

Source

Thrown at extensions/spring-boot-properties/deployment/src/main/java/io/quarkus/spring/boot/properties/deployment/InterfaceConfigurationPropertiesUtil.java:161

                ctor.body(bc -> {
                    bc.invokeSpecial(ConstructorDesc.of(Object.class), ctor.this_());
                    bc.set(ctor.this_().field(configField), configParam);
                    bc.return_();
                });
            });

            for (DotName ifaceDotName : allInterfaces) {
                ClassInfo classInfo = index.getClassByName(ifaceDotName);
                List<MethodInfo> methods = classInfo.methods();
                for (MethodInfo method : methods) {
                    Type returnType = method.returnType();
                    short methodModifiers = method.flags();
                    if (isDefault(methodModifiers) || Modifier.isStatic(methodModifiers)
                            || Modifier.isPrivate(methodModifiers)) {
                        continue;
                    }
                    if (!method.parameterTypes().isEmpty()) {
                        throw new IllegalArgumentException("Method " + method.name() + " of interface " + ifaceDotName
                                + " is not a getter method since it defined parameters");
                    }
                    if (returnType.kind() == Type.Kind.VOID) {
                        throw new IllegalArgumentException("Method " + method.name() + " of interface " + ifaceDotName
                                + " is not a getter method since it returns void");
                    }

                    NameAndDefaultValue nameAndDefaultValue = determinePropertyNameAndDefaultValue(method, namingStrategy);
                    String fullConfigName = prefixStr + "." + nameAndDefaultValue.getName();

                    cc.method(method.name(), mc -> {
                        mc.returning(ClassDesc.of(method.returnType().name().toString()));
                        mc.public_();

                        mc.body(bc -> {
                            if ((returnType.kind() == Type.Kind.CLASS)) {
                                ClassInfo returnTypeClassInfo = index.getClassByName(returnType.name());
                                if ((returnTypeClassInfo != null) && Modifier.isInterface(returnTypeClassInfo.flags())) {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Remove the parameters and turn the method into a plain getter.
  2. Mark helper/computed methods as default (with a body) or static so they are skipped.
  3. Move non-getter logic out of the config interface into a separate service class.

Example fix

// before
public interface AppProps {
    String getHost(int index);
}

// after
public interface AppProps {
    List<String> getHosts();

    default String getHost(int index) { return getHosts().get(index); }
}
Defensive patterns

Strategy: validation

Validate before calling

// every abstract method in a config interface must be a no-arg getter
for (Method m : AppProps.class.getMethods()) {
  if (!m.isDefault() && Modifier.isStatic(m.getModifiers()) == false
      && m.getParameterCount() > 0) {
    throw new IllegalStateException("Non-getter method in config interface: " + m.getName());
  }
}

Prevention

When it happens

Trigger: Declaring a method with parameters in an interface annotated with Spring-style @ConfigurationProperties (e.g. a computed accessor like getHost(int index)); raised at build time while generating the config implementation class.

Common situations: Porting an interface that mixed helper methods with getters; adding convenience accessors expecting them to be ignored; forgetting to mark helper methods as default or static.

Related errors


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