Repository navigation
Conversation
Extend the configuration schema to support the specification of common messages, when defining a messageSource bean
|
Hello all, I see this PR has been "partially" reviewed. In concept, does this pass muster, and can it be included in the coming RC? Is the idea sound here? |
| /** | ||
| * Comma-separated list of locale-independent common messages. | ||
| */ | ||
| private String commonMessages; |
There was a problem hiding this comment.
I think we might be better off using a List<Resource> here, that way the Binder can take care of creating the resource instances.
|
|
||
| try { | ||
| if (StringUtils.hasText(properties.getCommonMessages())) { | ||
| PropertiesFactoryBean propertiesFactory = new PropertiesFactoryBean(); |
There was a problem hiding this comment.
We might be better off using PropertiesLoaderUtils.fillProperties here rather than PropertiesFactoryBean. Using a FactoryBean isn't ideal since we need to call afterPropertiesSet etc.
| .toList(); | ||
| propertiesFactory.setLocations(commonResources.toArray(Resource[]::new)); | ||
| propertiesFactory.setSingleton(true); | ||
| propertiesFactory.setIgnoreResourceNotFound(true); |
There was a problem hiding this comment.
I think we should fail hard if the resource is not found.
# Conflicts: # spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/context/MessageSourceProperties.java
|
Thank you very much @philwebb . Updated PR based on your comments and resolved conflicts with upstream. Please resume. |
|
Side note: I think it would be good to disable the Gradle configuration cache for the project explicitly (in case someone has it globally enabled). otherwise things like this show up: ...which can be bypassed with an explicit |
Extend message source configuration properties and auto-configuration to support common messages. See gh-42472
|
Thanks very much @mmoayyed, this has been merged to |
This change extends the configuration schema to support the specification of common messages, when defining a
messageSourcebean. Common messages are described here:Still in the process of testing this, and figured it would be good to post this early to get feedback.
Thank you!