Just upgraded Spring Boot from 2.1.4.RELEASE to 2.2.5.RELEASE and my application.yml doesn't validate any longer.
For example, in this yaml, the itemOne
works in previous version but fails validation now.
test:
items:
itemOne:
COLOR: RED
ITEM2:
COLOR: BLUE
It seems any nested map key with uppercase letters will fail. Tried to debug and found getName()
in
ValidationBindHandler
mangles the key into
test.items[item-one].color
test.items[-i-t-e-m2].color
This is apparently incorrect.
The code to reproduce the error is at https://github.com/zzcoder/spring-validation-bug
Comment From: OrPolyzos
Apparently this is caused by the fix for the #19580
Comment From: mbhave
This appears to be caused by #17424. Instead of getting the value of the field using the getter it uses the boundResults
to look up the value. The field name doesn't match any names in the boundResults
lists and the value is null
, failing the rejectIfEmptyOrWhitespace
validation.
In the same above, the fieldName
is test.items[item-one].color
whereas boundResults
contains the key test.items.itemone.color
.