This is a difficult ticket requiring nontrivial refactoring (see comments on https://jira.spring.io/browse/SPR-9989 for details). I explored quite some alternatives and found the following plan most ideal:
-
tweak PropertyPlaceholderHelper's implementation to accept a new boolean parameter (ignoreDefault) to control whether default value will be used for a specific StringValueResolver;
-
change AbstractBeanFactory's internal implementation of 'resolveStringValue(String)' to dictate that only the last StringValueResolver will go about default value return (if needed) and ignore default value for all the other ones, by passing appropriate boolean parameter to the above tweaked PropertyPlaceHolderHelper's public method;
A a new unit testing method named 'resolveEmbeddedDefaultValue' was added to DefaultListableBeanFactoryTests.