Skip to content

UnboundConfigurationPropertiesException is no longer thrown from IndexedElementsBinder #45994

@winfriedgerlach

Description

@winfriedgerlach

Short story:

IndexedElementsBinder from Spring 3.5.0 doesn't throw UnboundConfigurationPropertiesException on missing target field any more, even on first element in a list.

Long story:

We are using Spring Boot to bind a list of configuration properties from a file to a @ConfigurationProperties class.

Our configuration looks like this:

prefix.list[0].a=value1
prefix.list[0].b=value2
prefix.list[1].a=value3
prefix.list[1].b=value4

(in fact, we are mapping lists of lists, but I think that our problem would also occur for a simple list)

With prior Spring Boot versions, both prefix.list[5].a=someValue and prefix.list[0].foo=someValue would throw UnboundConfigurationPropertiesException:

  • the former due to a "binding gap" in the list
  • the latter because the field "foo" does not exist in the target object (cf. IndexedElementsBinder 3.4.x: if (value == null) { break; }). This validation is now broken in Spring Boot 3.5.0.

Deeper analysis showed that our problem is caused by the changes in #44867. We are not particularly happy about these changes, because

  1. for us, full validation is more important than performance (sure, other users have other needs, cf. Provide a possibility to extend/override configuration properties binding process #42361) and
  2. @philwebb's assessment "with YAML configuration lists are unlikely to have missing elements" does not apply to us, as we are using plain old properties files

But even if we accept that configuration validation is only performed on the first 10 items in the list, IMHO Spring Boot should still detect if the target field does not exist. This was probably just an oversight when implementing #93113a4 ?

We would be glad if you had a look into this issue. Thanks everyone!

Activity

self-assigned this
on Jun 17, 2025
added this to the 3.5.1 milestone on Jun 17, 2025
changed the title [-]Broken configuration property validation in IndexedElementsBinder 3.5.0[/-] [+]UnboundConfigurationPropertiesException is no longer thrown from IndexedElementsBinder[/+] on Jun 17, 2025
added a commit that references this issue on Jun 17, 2025
8f14dca
philwebb

philwebb commented on Jun 17, 2025

@philwebb
Member

Thanks for raising the issue @winfriedgerlach. I've decided to pretty much revert 93113a4 since I hadn't anticipated how much it would break things.

winfriedgerlach

winfriedgerlach commented on Jun 18, 2025

@winfriedgerlach
Author

Thanks @philwebb for the incredibly quick response and the effort you put in to make binding more efficient! I am looking forward to 3.5.1 then!

One more thing I noticed with the implementation in 3.5.0: Even if the list contained only one element, IndexedElementsBinder#bindIndexed would still go through the loop ~10 times, which seemed odd to me. But I guess this observation is now obsolete anyway.

philwebb

philwebb commented on Jun 18, 2025

@philwebb
Member

bindIndexed would still go through the loop ~10 times, which seemed odd to me. But I guess this observation is now obsolete anyway.

Indeed, that caused a great deal of pain for nested lists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @philwebb@spring-projects-issues@winfriedgerlach

      Issue actions

        UnboundConfigurationPropertiesException is no longer thrown from IndexedElementsBinder · Issue #45994 · spring-projects/spring-boot