1
votes

I am trying to migrate an existing app from Spring, but I am hitting some issues. I have this in my application.properties:

sms.gateway.pinLength = 5

The class to load this property is as follows:

import io.quarkus.arc.config.ConfigProperties;

@ConfigProperties(prefix="sms.gateway")
public class SmsGatewayConfig {

    public Integer pinLength;

    public Integer getPinLength() {
        return pinLength;
    }

    public void setPinLength(Integer pinLength) {
        this.pinLength = pinLength;
    }
}

This triggers error message:

No config value of type [java.lang.Integer] exists for: sms.gateway.pin-length

If I change pinLength in the config file to pin-length, this same code works. Also, if I change this code to following, it also works without problem:

import javax.enterprise.context.ApplicationScoped;
import org.eclipse.microprofile.config.inject.ConfigProperty;

@ApplicationScoped
public class SmsGatewayConfig {

    @ConfigProperty(name="sms.gateway.pinLength")
    public Integer pinLength;

    public Integer getPinLength() {
        return pinLength;
    }

    public void setPinLength(Integer pinLength) {
        this.pinLength = pinLength;
    }
}

What am I missing? This works fine in Spring.

1

1 Answers

2
votes

Try it:

@ConfigProperties (namingStrategy = NamingStrategy.VERBATIM)

https://github.com/quarkusio/quarkus/wiki/Migration-Guide-1.2 (ConfigProperties session)