@ConfigurationProperties(prefix = "foo") data class Foo(val bar: Int?)
, when I write
foo.bar: "baz"
in my application.yaml, it still launches the application anyway and foo ends up being null. I want it to crash instead. Does anyone know if there's an easy way to achieve this?
Emil Kantis
11/04/2025, 9:03 AM
I must've oversimplified something. A friend confirmed that this crashes as expected for him, so digging into what's different 🙂
e
Edgar Avuzi
11/04/2025, 10:02 AM
Hi, so you both have different outcomes given the same setup?
Edgar Avuzi
11/04/2025, 10:05 AM
I was debugging a similar thing and understood that Spring can silently pass null. I think you will get the expected errors if you have
some:
foo:
bar: "baz"
instead
e
Emil Kantis
11/04/2025, 1:48 PM
We ended up testing with the wrong version of our code.. so the string was actually just never used.. 🤦♂️ homer disappear
👍 1
Emil Kantis
11/04/2025, 1:48 PM
It errored as expected in all scenarios I could come up with when trying to come up with a minimal reproducer..
👍 2
Emil Kantis
11/04/2025, 1:49 PM
I hope you figure out what scenario ended up with a silent null on your end though