Skip to content

PropertyOverrideConfigurer ignores some invalid keys but not others [SPR-5792] #10462

Closed
@spring-projects-issues

Description

@spring-projects-issues

Rob Hasselbaum opened SPR-5792 and commented

JavaDoc for PropertyOverrideConfigurer.setIgnoreInvalidKeys states: "If you ignore invalid keys, keys that do not follow the 'beanName.property' format will just be logged as warning. This allows [one] to have arbitrary other keys in a properties file." This isn't quite complete and accurate, though. Specifically:

(a) Some keys that DO follow the 'beanName.property' format are also ignored. Specifically, if the bean name does not exist, it will be ignored.

(b) If the bean name does exist, but the property doesn't exist or is not writable, an exception is thrown even if ignore invalid keys is set to true. This means you cannot have arbitrary other keys in the properties file.

One could address these points by clarifying the documentation, but I think there's a code problem here, too, because when I set ignore invalid keys to true, I'm expecting the configurer to ignore ALL invalid keys including those that match on the bean name but not on the property. So I propose changing the code to address that case and updating the JavaDoc accordingly.


Affects: 2.5.6

Issue Links:

Referenced from: commits ad492e9

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions