Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring Boot properties fail to find a property in native since 3.18.2 after SmallRye Config bump to 3.11.2 #46172

Open
michalvavrik opened this issue Feb 10, 2025 · 2 comments · May be fixed by #46249
Labels
area/config area/smallrye area/spring Issues relating to the Spring integration kind/bug Something isn't working

Comments

@michalvavrik
Copy link
Member

michalvavrik commented Feb 10, 2025

Describe the bug

I have a Quarkus application where I use Spring Boot properties. It works in JVM just fine, but after #46032 I can see that native fails to start. I have verified that with SmallRye Config 3.11.1, things work as expected.

Expected behavior

Application starts in native.

Actual behavior

Application fails to start with Failed to load config value of type java.util.List<java.lang.String> for: lists.strings.

How to Reproduce?

Steps to reproduce the behavior:

quarkus create app -x=spring-boot-properties,spring-web,rest-jackson
cd code-with-quarkus/
cat << 'EOF' > ./src/main/java/Props.java
import java.util.List;

import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties("lists")
public class Props {
    public List<String> strings;
}
EOF
cat << 'EOF' > ./src/main/java/Controller.java
import jakarta.inject.Inject;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/collections")
public class Controller {

    @Inject // Using `@Inject` instead of `@Autowired` to verify we can use both.
    Props listProperties;

    @GetMapping("/list/strings")
    public String listOfStrings() {
        return String.join(", ", listProperties.strings);
    }
}
EOF
echo "lists.strings[0]=Value 1" > src/main/resources/application.properties

# success
mvn clean package
java -jar target/quarkus-app/quarkus-run.jar
curl -v http://localhost:8080/collections/list/strings

# failure
mvn clean verify -Dnative

Output of uname -a or ver

Fedora

Output of java -version

Temurin 21

Quarkus version or git rev

3.18.2 +

Build tool (ie. output of mvnw --version or gradlew --version)

mvn 3.9.9

Additional information

No response

@michalvavrik michalvavrik added area/config area/spring Issues relating to the Spring integration kind/bug Something isn't working labels Feb 10, 2025
Copy link

quarkus-bot bot commented Feb 10, 2025

/cc @Ladicek (smallrye), @aureamunoz (spring), @geoand (spring), @jmartisk (smallrye), @phillip-kruger (smallrye), @radcortez (config,smallrye)

@radcortez
Copy link
Member

I'll have a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/config area/smallrye area/spring Issues relating to the Spring integration kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants