Skip to content

Spring Boot properties app throws NPE when endpoint accessed since Quarkus 3.18.1 #46341

@rsvoboda

Description

@rsvoboda

Describe the bug

Spring Boot properties app throws NPE when endpoint accessed since Quarkus 3.18.1

This issue was noticed by experiments after #46172 was fixed
So to reproduce this issue one needs to use explicitly 3.18.1 or the latest main. 3.18.2 and 3.18.3 can't be used because of #46172 issue which applies to 3.18.2+

Expected behavior

Application starts in native and provides the same content as in JVM mode.

Actual behavior

Application starts in native but provides NPE when endpoint is accessed

2025-02-18 16:56:21,363 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-1) HTTP Request to /collections/list/strings failed, error id: a7a8db78-577d-4992-aa8e-966d7a834da4-1: java.lang.NullPointerException
	at [email protected]/java.util.Objects.requireNonNull(Objects.java:233)
	at [email protected]/java.lang.String.join(String.java:3571)
	at Controller.listOfStrings(Controller.java:16)
	at Controller$quarkusrestinvoker$listOfStrings_f0a20cd7878bec0bdf406f2d32316e49afe9de50.invoke(Unknown Source)
	at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
	at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:141)
	at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:147)
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$15.runWith(VertxCoreRecorder.java:638)
	at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654)
	at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594)
	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11)
	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at [email protected]/java.lang.Thread.runWith(Thread.java:1596)
	at [email protected]/java.lang.Thread.run(Thread.java:1583)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:896)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:872)

How to Reproduce?

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 package -Dnative -Dquarkus.platform.group-id=io.quarkus -Dquarkus.platform.version=999-SNAPSHOT
target/code-with-quarkus-1.0.0-SNAPSHOT-runner
curl -v http://localhost:8080/collections/list/strings

Output of uname -a or ver

macOS 15.3.1

Output of java -version

Java 21

Mandrel or GraalVM version (if different from Java)

23.1.5.r21-mandrel

Quarkus version or git rev

3.18.1 or the latest main

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

Maven 3.9.8

Additional information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions