jdaugherty commented on code in PR #15964:
URL: https://github.com/apache/grails-core/pull/15964#discussion_r3562976929


##########
grails-gsp/grails-sitemesh3/src/main/java/org/grails/plugins/sitemesh3/Sitemesh3EnvironmentPostProcessor.java:
##########
@@ -0,0 +1,92 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    https://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.grails.plugins.sitemesh3;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.env.EnvironmentPostProcessor;
+import org.springframework.core.Ordered;
+import org.springframework.core.env.ConfigurableEnvironment;
+import org.springframework.core.env.MapPropertySource;
+
+import org.grails.web.util.WebUtils;
+
+/**
+ * Contributes the Grails defaults for the SiteMesh 3 configuration keys —
+ * layout selection via the {@code layout} meta tag, the
+ * {@code /layouts/} decorator prefix and, when configured, the application's
+ * default layout — before the application context refreshes.
+ *
+ * <p>Because these defaults are in the {@link ConfigurableEnvironment} from 
the
+ * start, both the SiteMesh starter's {@code @Value} placeholders and the 
Grails
+ * configuration (which is built from the environment) observe them without any
+ * post-hoc reassignment. This replaces the property-source manipulation the
+ * plugin previously performed in {@code doWithSpring()}.</p>
+ *
+ * <p>Each default is contributed only when the application has not set the key
+ * itself, and the source is appended with lowest precedence, so application
+ * configuration always wins.</p>
+ */
+public class Sitemesh3EnvironmentPostProcessor implements 
EnvironmentPostProcessor, Ordered {

Review Comment:
   The groovy idiom is the code is easier to read because of property 
references etc



-- 
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]

Reply via email to