jdaugherty commented on code in PR #16795:
URL: https://github.com/apache/grails-core/pull/16795#discussion_r4418908262
##########
grails-core/src/main/groovy/org/grails/spring/context/support/GrailsPlaceholderConfigurer.java:
##########
@@ -78,6 +92,34 @@ public void setBeanFactory(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
}
+ @Override
+ public void setEnvironment(Environment environment) {
+ super.setEnvironment(environment);
+ this.environment = environment;
+ }
+
+ /**
+ * Resolves a placeholder that names a list of plain values, such as
{@code ${app.names}}, to the
+ * elements of the list joined by commas, when neither the environment nor
the local properties have
+ * a value under that name.
+ *
+ * <p>The environment presents a configuration list only under its indexed
names, such as
+ * {@code app.names[0]}, so that Spring Boot binds it element by element.
The list is read as Spring
+ * Boot binds it, from the property source of the highest priority that
sets it, and the placeholders
+ * in its elements are resolved with the rest of the value. The name is
matched as
+ * {@code @ConfigurationProperties} binding matches it, so {@code
${app.allowedOrigins}} and
+ * {@code ${app.allowed-origins}} read the same list. A list holding
objects has no value a
+ * placeholder could be replaced with, so a placeholder naming it is not
resolved.</p>
+ */
+ @Override
+ protected ConfigurablePropertyResolver
createPropertyResolver(MutablePropertySources propertySources) {
+ if (this.environment instanceof ConfigurableEnvironment
configurableEnvironment &&
Review Comment:
Fixed in 9d98b7d677: the list source is added only when
`environmentProperties`, the source Spring adds for the environment, is among
the selected sources. With `setPropertySources(new MutablePropertySources())`
and `app.names: [first, second]` in the environment, `${app.names:fallback}`
now resolves to `fallback`, as it does with Spring's configurer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]