spring-projects / spring-projects/spring-boot

Configuration properties of type Class should not require a dedicated reflection hint to be bound on native

Open
#50,221 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
Dominant language
Java
Stars
81.5k
Forks
42.7k
Avg merge
2d 4h
Merged PRs (30d)
65

Description

Native builds of applications based on Spring Boot 4.1.0-RC1 fail to start if it has dependencies on either:

  1. spring-boot-starter-validation
  2. spring-boot-starter-kafka

To reproduce the errors, use the attached zipped application and run the following commands:

sb41-native-demo.zip

1. spring-boot-starter-validation

./gradlew bootBuildImage
docker run sb41-native-demo:0.0.1-SNAPSHOT   

The start will fail with the error message:

Caused by: java.lang.IllegalArgumentException: Invalid logger interface org.hibernate.validator.internal.util.logging.Log (implementation not found)

For a full log, see sb410rc1-native-validator-error.log.

2. spring-boot-starter-kafka

First, remove the dependency on spring-boot-starter-validation and remove all annotations in src/main/java/com/example/sb41_native_demo/AppProperties.java that come from that dependency.

Next, run the commands:

./gradlew bootBuildImage
docker run sb41-native-demo:0.0.1-SNAPSHOT   

The start will fail with the error message:

Failed to bind properties under 'spring.kafka.consumer.key-deserializer' to java.lang.Class<?>:

For a full log, see sb410rc1-native-kafka-error.log.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached sb41-native-demo.zip and reproduce both failures using the documented bootBuildImage and docker run commands. Inspect AppProperties.java and the full validator and Kafka error logs, then trace the native configuration-property binding path. Done means both applications start successfully without requiring a dedicated reflection hint for Class-valued properties.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.