You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
When executing the following application:
with the following
application.yml
file:where
foo
is intentionally commented out, the application fails to start (as expected), but with a confusing error message:The
Reason
part is correct: the parameter foo is missing. But theProperty
is incorrect: what is missing is the propertyfoo
, not the propertybar
. And theValue: world
is irrelevant to the problem, too.The text was updated successfully, but these errors were encountered: