-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Closed
Description
When executing the following application:
package com.example.demo
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.boot.context.properties.ConstructorBinding
import org.springframework.boot.runApplication
@SpringBootApplication
class BadErrorMessageApplication
@ConfigurationProperties(prefix = "test")
@ConstructorBinding
class MyProperties(val foo: String, val bar: String)
fun main(args: Array<String>) {
runApplication<BadErrorMessageApplication>(*args)
}
with the following application.yml file:
test:
# foo: hello
bar: world
where foo is intentionally commented out, the application fails to start (as expected), but with a confusing error message:
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to bind properties under 'test' to com.example.demo.MyProperties:
Property: test.bar
Value: world
Origin: class path resource [application.yml]:3:8
Reason: Parameter specified as non-null is null: method com.example.demo.MyProperties.<init>, parameter foo
Action:
Update your application's configuration
The Reason part is correct: the parameter foo is missing. But the Property is incorrect: what is missing is the property foo, not the property bar. And the Value: world is irrelevant to the problem, too.
Metadata
Metadata
Assignees
Labels
type: bugA general bugA general bug