You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@grails.apache.org by "codeconsole (via GitHub)" <gi...@apache.org> on 2026/06/22 06:37:47 UTC
[PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
codeconsole opened a new pull request, #13863:
URL: https://github.com/apache/grails-core/pull/13863
This produces unknown/unexpected behavior and should not be done. @EnableWebMvc is a Spring Framework configuration annotation not to be used with Spring Boot. It produces undesired behavior by automatically creating beans that are not wanted. WebMvcAutoConfiguration performs all the behavior of this configuration because it extends it and adds conditional logic.
Fixes
```
Overriding bean definition for bean 'localeResolver' with a different definition: replacing [Root bean: class=null; scope=; abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; fallback=false; factoryBeanName=org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration; factoryMethodName=localeResolver; initMethodNames=null; destroyMethodNames=[(inferred)]; defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration] with [Generic bean: class=org.springframework.web.servlet.i18n.SessionLocaleResolver; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; fallback=false; factoryBeanName=null; factoryMethodName=null; initMethodNames=null; destroyMethodNames=null]
Overriding bean definition for bean 'org.springframework.aop.config.internalAutoProxyCreator' with a different definition: replacing [Root bean: class=org.springframework.aop.framework.autoproxy.InfrastructureAdvisorAutoProxyCreator; scope=; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; fallback=false; factoryBeanName=null; factoryMethodName=null; initMethodNames=null; destroyMethodNames=null] with [Generic bean: class=org.grails.spring.aop.autoproxy.GroovyAwareInfrastructureAdvisorAutoProxyCreator; scope=singleton; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; fallback=false; factoryBeanName=null; factoryMethodName=null; initMethodNames=null; destroyMethodNames=null]
```
```java
class WebMvcAutoConfiguration {
static class EnableWebMvcConfiguration extends DelegatingWebMvcConfiguration {
}
}
class DelegatingWebMvcConfiguration extends WebMvcConfigurationSupport {
}
class WebMvcConfigurationSupport extends WebMvcConfigurationSupport {
@Bean public LocaleResolver localeResolver() { }
}
```
vs
```java
@Import(DelegatingWebMvcConfiguration.class)
public @interface EnableWebMvc { }
```
# This pull request is not finished
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#issuecomment-4805710670
## π No tests executed π
π·οΈ Commit: 7692dbc571a1a8233f6c5f3e88e87cb7f4ec96d4
βΆοΈ Tests: 0 executed
βͺοΈ Checks: 46/46 completed
---
_Learn more about TestLens at [testlens.app](https://testlens.app)._
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#issuecomment-4811760578
## β
All tests passed β
π·οΈ Commit: 341699382dfe226fb32e61d2487b93f169f0cd08
βΆοΈ Tests: 24509 executed
βͺοΈ Checks: 46/46 completed
---
_Learn more about TestLens at [testlens.app](https://testlens.app)._
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty closed pull request #13863: Stop @EnableWebMvc from being automatically added to Grails Applications
URL: https://github.com/apache/grails-core/pull/13863
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#issuecomment-4920464588
@codeconsole I pushed the test showing the material differences. In summary:
4 failures β each one a Grails 8 behavior change:
1. DELETE form body β json.title expected null, got The Stand ([method:DELETE, title:The Stand, pages:1153]): Boot's OrderedFormContentFilter now parses the DELETE body into params.
2. Static resource β /boot-default-mapping.txt expected 404, got 200: Boot's catch-all resource handler now serves classpath:/public at the root.
3. Welcome page β / expected 404, got 200: Boot's WelcomePageHandlerMapping now serves the static index.html.
4. Locale β expected fr_FR (Accept-Language), got de: grails-i18n's SessionLocaleResolver is active, so ?lang=de works.
I think `#4` is expected and a better behavior, so I'm ok with that. But 1-3 are definitely behavior differences that are material. We shouldn't be serving assets that Grails doesn't know about nor should we have other mappings.
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "codeconsole (via GitHub)" <gi...@apache.org>.
codeconsole commented on code in PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#discussion_r3554651982
##########
grails-test-examples/spring-security/core/integration-test-app/src/integration-test/groovy/grails/plugin/springsecurity/SpringSecurityUtilsIntegrationSpec.groovy:
##########
@@ -89,15 +87,14 @@ class SpringSecurityUtilsIntegrationSpec extends AbstractIntegrationSpec {
def map = SpringSecurityUtils.configuredOrderedFilters
expect:
- 10 == map.size()
+ 9 == map.size()
Review Comment:
Yes β and now earlier than before. The plugin used to register `FormContentFilter` inside the chain at `EXCEPTION_TRANSLATION_FILTER.order - 10` (just before `FilterSecurityInterceptor`). The servlet-level `FormContentFilter` runs at order `-9500`, ahead of the whole `springSecurityFilterChain` (`-100`), so it parses the body into params before *any* security filter β including `FilterSecurityInterceptor`. Confirmed by `TestFormParamsControllerSpec` (the putWithParams config): 12/12 with the plugin filter removed, covering `x-www-form-urlencoded` `PUT`/`PATCH` params on a permitAll endpoint (params extracted) and on a secured endpoint (still redirected to login).
##########
grails-controllers/src/main/groovy/org/grails/plugins/web/controllers/GrailsFormContentFilterAutoConfiguration.java:
##########
@@ -0,0 +1,87 @@
+/*
+ * 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.web.controllers;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.springframework.boot.autoconfigure.AutoConfiguration;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
+import org.springframework.boot.servlet.filter.OrderedFormContentFilter;
+import org.springframework.boot.webmvc.autoconfigure.WebMvcAutoConfiguration;
+import org.springframework.context.annotation.Bean;
+import org.springframework.web.filter.FormContentFilter;
+
+/**
+ * Guarantees a {@link FormContentFilter} for every Grails servlet web application, so
+ * {@code application/x-www-form-urlencoded} bodies of {@code PUT}, {@code PATCH} and {@code DELETE}
+ * requests are parsed into request parameters and are visible through the standard
+ * {@code request.getParameter(...)} API. Only that content type is affected β other request bodies
+ * (JSON, multipart, etc.) are untouched and remain available to data binding.
+ *
+ * Spring Boot's {@link WebMvcAutoConfiguration} already contributes an {@code OrderedFormContentFilter}
+ * for a default Grails application, in which case this auto-configuration backs off. It only fills the
+ * gap when Boot's is absent β most notably when the application declares {@code @EnableWebMvc}, which
+ * backs off the whole {@link WebMvcAutoConfiguration}. Grails supplies the filter itself so that form
+ * parsing does not depend on Boot's MVC auto-configuration being active.
+ *
+ * <p>Ordered after {@link WebMvcAutoConfiguration} so Boot's filter, when present, takes precedence and
+ * this one backs off via {@link ConditionalOnMissingBean}. The explicit opt-out
+ * {@code spring.mvc.formcontent.filter.enabled=false} disables the filter here just as it does for Boot,
+ * so it remains a true off-switch rather than something Grails silently re-enables.
+ */
+@AutoConfiguration(after = WebMvcAutoConfiguration.class)
+@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
+public class GrailsFormContentFilterAutoConfiguration {
+
+ private static final Logger logger = LoggerFactory.getLogger(GrailsFormContentFilterAutoConfiguration.class);
+
+ @Bean
+ @ConditionalOnMissingBean(FormContentFilter.class)
+ @ConditionalOnBooleanProperty(name = "spring.mvc.formcontent.filter.enabled", matchIfMissing = true)
+ public OrderedFormContentFilter formContentFilter() {
Review Comment:
Yes β and now earlier than before. The plugin used to register `FormContentFilter` inside the chain at `EXCEPTION_TRANSLATION_FILTER.order - 10` (just before `FilterSecurityInterceptor`). The servlet-level `FormContentFilter` runs at order `-9500`, ahead of the whole `springSecurityFilterChain` (`-100`), so it parses the body into params before *any* security filter β including `FilterSecurityInterceptor`. Confirmed by `TestFormParamsControllerSpec` (the putWithParams config): 12/12 with the plugin filter removed, covering `x-www-form-urlencoded` `PUT`/`PATCH` params on a permitAll endpoint (params extracted) and on a secured endpoint (still redirected to login).
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#issuecomment-4905553859
Merged the latest 8.x changes, which should resolve failing tests.
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "codeconsole (via GitHub)" <gi...@apache.org>.
codeconsole commented on PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#issuecomment-4792387714
@sbglasius thanks for the review β I've documented this so users can see why an app might be affected and how to control it:
- **Upgrade notes**: new section *"27. @EnableWebMvc No Longer Added to Grails Applications"* in `grails-doc` (`upgrading80x.adoc`). It covers the two user-visible behaviors and their opt-outs β the `Circular view path` symptom from Boot's `defaultViewResolver` (`grails.web.removeDefaultViewResolverBean`, default `true`) and the `GrailsWebRequest` binding.
- **PR description**: updated to spell out the full scope (the `defaultViewResolver` consolidation and the `GrailsWebRequestFilter` β `RequestContextFilter` change), since the original only mentioned the `@EnableWebMvc` removal β which I think is what made the impact hard to gauge.
- **Tests**: added `ControllersAutoConfigurationSpec`, which proves Boot's `requestContextFilter` actually backs off (with a contrast case showing it's present without the Grails auto-config), so the binding behavior is regression-guarded.
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#issuecomment-4929239369
## β
All tests passed β
π·οΈ Commit: 4e458f662aba042524b5956ad6a12d2158fc634d
βΆοΈ Tests: 9544 executed
βͺοΈ Checks: 61/61 completed
---
_Learn more about TestLens at [testlens.app](https://testlens.app)._
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "codeconsole (via GitHub)" <gi...@apache.org>.
codeconsole commented on PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#issuecomment-4925520528
### Form-content parsing: consolidating on `FormContentFilter`
Following up on @jdaugherty's first point (the newly-active `OrderedFormContentFilter`), I've made the filter the **single** mechanism for parsing non-POST form bodies, rather than having it coexist with `GrailsParameterMap`'s own PUT/PATCH parsing.
**What changed**
- `GrailsParameterMap` no longer parses `PUT`/`PATCH` bodies itself. At runtime the request has already passed through `OrderedFormContentFilter` (order `-9500`, ahead of the Grails and Spring Security filters), so its inline `if (requestMap.isEmpty()) β¦` parse never actually ran β it only fired in unit tests and filter-absent configs. It's removed; `GrailsMockHttpServletRequest` now simulates the filter so the unit-test ergonomic (set a form body, read `params`) is preserved.
- New `GrailsFormContentFilterAutoConfiguration` guarantees a `FormContentFilter` for every Grails servlet app. Boot registers one for a default app; this only **fills the gap** when Boot's `WebMvcAutoConfiguration` backs off (i.e. an `@EnableWebMvc` app). It's ordered after `WebMvcAutoConfiguration` and gated on `@ConditionalOnMissingBean(FormContentFilter)`, so Boot's takes precedence by default and Grails only supplies one when it's absent. `spring.mvc.formcontent.filter.enabled=false` still disables it β that stays a real off-switch.
Net: `PUT`/`PATCH`/`DELETE` form bodies parse uniformly in every Grails servlet app unless explicitly disabled.
**On `DELETE` β and a heads-up on the `enable-mvc-check` test**
The `enable-mvc-check` `Application` class **imported** `@EnableWebMvc` but never actually applied the annotation (the class only had `@CompileStatic`), so the app was silently running as a normal Grails app β which is why its `DELETE` and locale assertions were failing on the branch. I applied the annotation.
With the annotation applied *and* the fallback filter in place, `DELETE` form bodies are now parsed even under `@EnableWebMvc`, so I flipped the `DELETE` spec from "not parsed" to "parsed." **This intentionally reverses the Grails-7 parity that test asserted, and I want to flag it explicitly.**
The reasoning: parsing a `DELETE` form body is benign and consistent β Boot does it by default, `grails-spring-security` has registered a `FormContentFilter` (which handles DELETE) for years, and the old "`PUT`/`PATCH` yes, `DELETE` no" split was a historical accident in `GrailsParameterMap`, not a deliberate rule. The only argument for *not* parsing it is byte-for-byte Grails-7 parity for the `@EnableWebMvc` escape hatch β i.e. preserving a silently-ignored `DELETE` body that essentially no application relies on. The deliberate change here is specifically that form-content parsing (`PUT`/`PATCH`/`DELETE`) is always on β even under `@EnableWebMvc` β unless disabled via `spring.mvc.formcontent.filter.enabled=false`.
If the consensus is that `@EnableWebMvc` should be exactly Grails 7 on this point too, I'm happy to switch the fallback to a `FormContentFilter` subclass that skips `DELETE` (via `shouldNotFilter`) β but I think uniform parsing is the better default.
**Verification**: `enable-mvc-check` functional spec (7/7), new `GrailsFormContentFilterAutoConfigurationSpec` (5/5), plus `grails-controllers` / `grails-web-common` / `grails-test-suite-uber` / `grails-test-suite-web` green; Checkstyle / CodeNarc / PMD / SpotBugs clean.
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#issuecomment-4920585907
## π¨ TestLens detected 4 failed tests π¨
Here is what you can do:
1) Inspect the test failures carefully.
2) If you are convinced that some of the tests are flaky, you can mute them below.
3) Finally, trigger a rerun by checking the rerun checkbox.
### Test Summary
#### [CI / Functional Tests \(Java 21, indy\=false\)](https://github.com/apache/grails-core/actions/runs/28985870884/job/86014727773?pr=13863) > :grails-test-examples-enable-mvc-check:integrationTest
| Test | Runs | Flakiness |
|---|---|--:|
| WebMvcDefaultsFunctionalSpec > a classpath:/public resource is not served at the context root | β | 0% π’ |
| WebMvcDefaultsFunctionalSpec > a form-encoded DELETE body is not parsed into request parameters | β | 0% π’ |
| WebMvcDefaultsFunctionalSpec > locale resolution follows the Accept-Language header and the lang request parameter is ignored | β | 0% π’ |
| WebMvcDefaultsFunctionalSpec > no static index.html welcome page is served for the unmapped root path | β | 0% π’ |
π·οΈ Commit: 574470e1a12acedc43548251a9d0d1f381ac3c19
βΆοΈ Tests: 22797 executed
π‘ Checks: 23/55 completed
### Test Failures
<details>
<summary><strong>WebMvcDefaultsFunctionalSpec > a classpath:/public resource is not served at the context root</strong> (:grails-test-examples-enable-mvc-check:integrationTest in <a href="https://github.com/apache/grails-core/actions/runs/28985870884/job/86014727773?pr=13863">CI / Functional Tests (Java 21, indy=false)</a>)</summary>
```
Condition failed with Exception:
response.assertStatus(404)
| |
| org.opentest4j.AssertionFailedError: HTTP Status differs
| at org.apache.grails.testing.http.client.TestHttpResponse.verify(TestHttpResponse.groovy:980)
| at org.apache.grails.testing.http.client.TestHttpResponse.verifyStatus(TestHttpResponse.groovy:840)
| at org.apache.grails.testing.http.client.TestHttpResponse.assertStatus(TestHttpResponse.groovy:174)
| at enablemvccheck.WebMvcDefaultsFunctionalSpec.a classpath:/public resource is not served at the context root(WebMvcDefaultsFunctionalSpec.groovy:109)
<org.apache.grails.testing.http.client.TestHttpResponse@40e420fe delegate=inaccessible jsonSlurperConfig=inaccessible xmlSlurperConfig=inaccessible>
at enablemvccheck.WebMvcDefaultsFunctionalSpec.a classpath:/public resource is not served at the context root(WebMvcDefaultsFunctionalSpec.groovy:109)
Caused by: org.opentest4j.AssertionFailedError: HTTP Status differs
at org.apache.grails.testing.http.client.TestHttpResponse.verify(TestHttpResponse.groovy:980)
at org.apache.grails.testing.http.client.TestHttpResponse.verifyStatus(TestHttpResponse.groovy:840)
at org.apache.grails.testing.http.client.TestHttpResponse.assertStatus(TestHttpResponse.groovy:174)
... 1 more
```
</details>
<details>
<summary><strong>WebMvcDefaultsFunctionalSpec > a form-encoded DELETE body is not parsed into request parameters</strong> (:grails-test-examples-enable-mvc-check:integrationTest in <a href="https://github.com/apache/grails-core/actions/runs/28985870884/job/86014727773?pr=13863">CI / Functional Tests (Java 21, indy=false)</a>)</summary>
```
Condition not satisfied:
json.title == null
| | |
| | false
| The Stand
[method:DELETE, title:The Stand, pages:1153]
at enablemvccheck.WebMvcDefaultsFunctionalSpec.a form-encoded DELETE body is not parsed into request parameters(WebMvcDefaultsFunctionalSpec.groovy:69)
```
|expected|actual|
|---|---|
|<s>null</s>|<b>The Stand</b>|
</details>
<details>
<summary><strong>WebMvcDefaultsFunctionalSpec > locale resolution follows the Accept-Language header and the lang request parameter is ignored</strong> (:grails-test-examples-enable-mvc-check:integrationTest in <a href="https://github.com/apache/grails-core/actions/runs/28985870884/job/86014727773?pr=13863">CI / Functional Tests (Java 21, indy=false)</a>)</summary>
```
Condition not satisfied:
response.json().locale == 'fr_FR'
| | | |
| | de false
| [locale:de] 5 differences (0% similarity)
| (de---)
| (fr_FR)
<org.apache.grails.testing.http.client.TestHttpResponse@230ea983 delegate=inaccessible jsonSlurperConfig=inaccessible xmlSlurperConfig=inaccessible>
at enablemvccheck.WebMvcDefaultsFunctionalSpec.locale resolution follows the Accept-Language header and the lang request parameter is ignored(WebMvcDefaultsFunctionalSpec.groovy:132)
```
|expected|actual|
|---|---|
|<s>fr_FR</s>|<b>de</b>|
</details>
<details>
<summary><strong>WebMvcDefaultsFunctionalSpec > no static index.html welcome page is served for the unmapped root path</strong> (:grails-test-examples-enable-mvc-check:integrationTest in <a href="https://github.com/apache/grails-core/actions/runs/28985870884/job/86014727773?pr=13863">CI / Functional Tests (Java 21, indy=false)</a>)</summary>
```
Condition failed with Exception:
response.assertStatus(404)
| |
| org.opentest4j.AssertionFailedError: HTTP Status differs
| at org.apache.grails.testing.http.client.TestHttpResponse.verify(TestHttpResponse.groovy:980)
| at org.apache.grails.testing.http.client.TestHttpResponse.verifyStatus(TestHttpResponse.groovy:840)
| at org.apache.grails.testing.http.client.TestHttpResponse.assertStatus(TestHttpResponse.groovy:174)
| at enablemvccheck.WebMvcDefaultsFunctionalSpec.no static index.html welcome page is served for the unmapped root path(WebMvcDefaultsFunctionalSpec.groovy:117)
<org.apache.grails.testing.http.client.TestHttpResponse@7d6e2366 delegate=inaccessible jsonSlurperConfig=inaccessible xmlSlurperConfig=inaccessible>
at enablemvccheck.WebMvcDefaultsFunctionalSpec.no static index.html welcome page is served for the unmapped root path(WebMvcDefaultsFunctionalSpec.groovy:117)
Caused by: org.opentest4j.AssertionFailedError: HTTP Status differs
at org.apache.grails.testing.http.client.TestHttpResponse.verify(TestHttpResponse.groovy:980)
at org.apache.grails.testing.http.client.TestHttpResponse.verifyStatus(TestHttpResponse.groovy:840)
at org.apache.grails.testing.http.client.TestHttpResponse.assertStatus(TestHttpResponse.groovy:174)
... 1 more
```
</details>
### Muted Tests
> [!NOTE]
> Checks are currently running using the configuration below.
Select tests to mute in this pull request:
π² WebMvcDefaultsFunctionalSpec > a classpath:/public resource is not served at the context root <!-- uniqueId=[engine:spock]/[spec:enablemvccheck.WebMvcDefaultsFunctionalSpec]/[feature:$spock_feature_0_3] -->
π² WebMvcDefaultsFunctionalSpec > a form-encoded DELETE body is not parsed into request parameters <!-- uniqueId=[engine:spock]/[spec:enablemvccheck.WebMvcDefaultsFunctionalSpec]/[feature:$spock_feature_0_0] -->
π² WebMvcDefaultsFunctionalSpec > locale resolution follows the Accept-Language header and the lang request parameter is ignored <!-- uniqueId=[engine:spock]/[spec:enablemvccheck.WebMvcDefaultsFunctionalSpec]/[feature:$spock_feature_0_5] -->
π² WebMvcDefaultsFunctionalSpec > no static index.html welcome page is served for the unmapped root path <!-- uniqueId=[engine:spock]/[spec:enablemvccheck.WebMvcDefaultsFunctionalSpec]/[feature:$spock_feature_0_4] -->
Reuse successful test results:
π² β»οΈ Only rerun the tests that failed or were muted before
Click the checkbox to trigger a rerun:
π² **Rerun jobs**
---
_Learn more about TestLens at [testlens.app](https://testlens.app)._
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#issuecomment-4926610555
## β
All tests passed β
π·οΈ Commit: 18bf407db3f7fa1705e4f32ad0618f637f71b6fc
βΆοΈ Tests: 61730 executed
βͺοΈ Checks: 61/61 completed
---
_Learn more about TestLens at [testlens.app](https://testlens.app)._
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on code in PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#discussion_r3552114469
##########
grails-doc/src/en/guide/i18n/changingLocales.adoc:
##########
@@ -28,7 +28,19 @@ Grails will automatically switch the user's locale and subsequent requests will
By default, Grails uses {springapi}org/springframework/web/servlet/i18n/SessionLocaleResolver.html[SessionLocaleResolver] as the `localeResolver` bean.
-You can change the default locale easily:
+You can select a different resolver strategy with the `grails.i18n.localeResolver` configuration property, without declaring a bean:
+
+[source,yaml]
+.grails-app/conf/application.yml
+----
+grails:
+ i18n:
+ localeResolver: acceptHeader # session (default), cookie, acceptHeader or fixed
+----
+
+`session` and `cookie` are mutable, so the `?lang=` switch works with them. `acceptHeader` (the locale follows the incoming `Accept-Language` header) and `fixed` are read-only, so the `?lang=` switch has no effect and is silently ignored. The `fixed` resolver uses `grails.i18n.default.locale`, falling back to the JVM default locale.
Review Comment:
So the url will override the header now with your changes? or vice versa?
##########
grails-core/src/main/groovy/grails/config/Settings.groovy:
##########
@@ -270,6 +270,13 @@ interface Settings {
*/
String WEB_REMOVE_DEFAULT_VIEW_RESOLVER_BEAN = 'grails.web.removeDefaultViewResolverBean'
+ /**
+ * Whether to remove Spring Boot's welcome-page handler mappings so Grails' own URL mappings
+ * own the root path ('/') rather than a static {@code index.html} being served for it.
+ * Defaults to true
+ */
+ String WEB_REMOVE_WELCOME_PAGE_MAPPING = 'grails.web.removeWelcomePageMapping'
Review Comment:
the spring-config-metadata json file needs updated for this new setting & any others that were added.
##########
grails-test-examples/enable-mvc-check/README.md:
##########
@@ -0,0 +1,62 @@
+<!--
+SPDX-License-Identifier: Apache-2.0
+
+Licensed 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.
+-->
+
+# enable-mvc-check
+
+A dedicated Grails functional test application that pins down the behavior of
Review Comment:
We should probably remove this file now. It was just here to help you understand the test.
##########
grails-web-common/src/test/groovy/grails/web/servlet/mvc/GrailsParameterMapTests.groovy:
##########
@@ -92,82 +97,47 @@ class GrailsParameterMapTests {
}
@Test
- void testParseRequestBodyForPutRequest() {
- def request = new MockHttpServletRequest()
- request.content = 'foo=bar&one=two'.bytes
- request.method = 'PUT'
- request.contentType = "application/x-www-form-urlencoded"
-
- def params = new GrailsParameterMap(request)
+ void testFormEncodedPutBodyIsExposedAsParams() {
+ def params = new GrailsParameterMap(formFilteredRequest('PUT', 'foo=bar&one=two', 'application/x-www-form-urlencoded'))
assert 'bar' == params.foo
assert 'two' == params.one
-
- params = new GrailsParameterMap(request)
- assert params.foo == null // should be null, request can't be parsed twice
-
- request = new MockHttpServletRequest()
- request.method = 'PUT'
- request.content = 'foo='.bytes
- request.contentType = "application/x-www-form-urlencoded"
- request.removeAttribute(GrailsParameterMap.REQUEST_BODY_PARSED)
-
- params = new GrailsParameterMap(request)
-
- assert '' == params.foo
}
@Test
- void testParseRequestBodyForPutRequestWithCharset() {
- def request = new MockHttpServletRequest()
- request.content = 'foo=bar&one=two'.bytes
- request.method = 'PUT'
- request.contentType = "application/x-www-form-urlencoded; charset=UTF-8"
-
- def params = new GrailsParameterMap(request)
+ void testFormEncodedPutBodyWithCharsetIsExposedAsParams() {
+ def params = new GrailsParameterMap(formFilteredRequest('PUT', 'foo=bar&one=two', 'application/x-www-form-urlencoded; charset=UTF-8'))
assert 'bar' == params.foo
assert 'two' == params.one
-
- params = new GrailsParameterMap(request)
- assert params.foo == null // should be null, request can't be parsed twice
-
- request = new MockHttpServletRequest()
- request.method = 'PUT'
- request.contentType = "application/x-www-form-urlencoded; charset=UTF-8"
- request.content = 'foo='.bytes
- request.removeAttribute(GrailsParameterMap.REQUEST_BODY_PARSED)
-
- params = new GrailsParameterMap(request)
-
- assert '' == params.foo
}
@Test
- void testParseRequestBodyForPatchRequest() {
- def request = new MockHttpServletRequest()
- request.content = 'foo=bar&one=two'.bytes
- request.method = 'PATCH'
- request.contentType = "application/x-www-form-urlencoded"
-
- def params = new GrailsParameterMap(request)
+ void testFormEncodedPatchBodyIsExposedAsParams() {
+ def params = new GrailsParameterMap(formFilteredRequest('PATCH', 'foo=bar&one=two', 'application/x-www-form-urlencoded'))
assert 'bar' == params.foo
assert 'two' == params.one
+ }
- params = new GrailsParameterMap(request)
- assert params.foo == null // should be null, request can't be parsed twice
-
- request = new MockHttpServletRequest()
Review Comment:
Since you're relying on the form filter now, you should add a functioanl test to cover these removed scenarios
##########
grails-doc/src/en/guide/upgrading/upgrading80x.adoc:
##########
@@ -1396,6 +1396,31 @@ Grails 8 registers its request-binding filter as a `RequestContextFilter` bean s
This is handled internally and requires no configuration changes.
Applications that defined their own `GrailsWebRequestFilter` bean, or their own `grailsWebRequestFilter` filter-registration bean, continue to override the Grails-provided ones.
+===== 31.3 Other Boot MVC features now active
+
+Because Boot's `WebMvcAutoConfiguration` is now active, a handful of its features that `@EnableWebMvc` previously suppressed take effect for Grails servlet web applications.
+None require action for a typical application, but they are behavioral differences worth knowing about when you upgrade:
+
+* **Form-content filter for `PUT` / `PATCH` / `DELETE`.** A `FormContentFilter` parses `application/x-www-form-urlencoded` bodies of `PUT`, `PATCH` and `DELETE` requests so their fields are visible through the standard `request.getParameter(...)` API (and therefore in `params`). Boot's `OrderedFormContentFilter` provides it for a default application; for an application that declares `@EnableWebMvc` β where Boot's MVC auto-configuration backs off β Grails contributes an equivalent filter itself, so form parameters behave the same either way. In Grails 7 only `PUT` and `PATCH` bodies were parsed (by `GrailsParameterMap`) and `DELETE` was not; all three are now handled uniformly by the filter. It is enabled by default via `spring.mvc.formcontent.filter.enabled`; setting that to `false` disables `PUT` / `PATCH` / `DELETE` form-parameter parsing entirely. An application that reads those bodies itself can disable it:
++
+[source,yaml]
+.application.yml
+----
+spring:
+ mvc:
+ formcontent:
+ filter:
+ enabled: false
+----
+
+* **`spring.mvc.*` and `spring.web.*` properties now apply.** Properties such as `spring.web.locale`, `spring.mvc.format.date` / `time` / `date-time`, and `spring.web.resources.*` were inert before and now take effect. Review any of these you may have set inadvertently (for example copied from Boot documentation).
+
+* **Boot static-resource handling and welcome page.** Boot adds a catch-all resource handler (`classpath:/META-INF/resources/`, `/resources/`, `/static/`, `/public/`) and a `WelcomePageHandlerMapping` for a static `index.html`, alongside Grails' own resource handling. A request that previously fell through to Grails' URL-mapping error handling may now be served as a static resource or welcome page β worth checking in applications with catch-all URL mappings or custom 404 handling. Set `spring.web.resources.add-mappings: false` to disable the static-resource handler.
Review Comment:
This file is out of date.
##########
grails-controllers/src/main/groovy/org/grails/plugins/web/controllers/GrailsFormContentFilterAutoConfiguration.java:
##########
@@ -0,0 +1,56 @@
+/*
+ * 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.web.controllers;
+
+import org.springframework.boot.autoconfigure.AutoConfiguration;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
+import org.springframework.boot.servlet.filter.OrderedFormContentFilter;
+import org.springframework.boot.webmvc.autoconfigure.WebMvcAutoConfiguration;
+import org.springframework.context.annotation.Bean;
+import org.springframework.web.filter.FormContentFilter;
+
+/**
+ * Guarantees a {@link FormContentFilter} for every Grails servlet web application, so form-encoded
+ * {@code PUT}, {@code PATCH} and {@code DELETE} bodies are parsed into request parameters and are
Review Comment:
The part I did not understand was this is supposed to only apply for `application/x-www-form-urlencoded` request bodies, so I am ok with the changes. But we should update the documentation so this is clear.
##########
grails-web-common/src/test/groovy/grails/web/servlet/mvc/GrailsParameterMapTests.groovy:
##########
@@ -92,82 +97,47 @@ class GrailsParameterMapTests {
}
@Test
- void testParseRequestBodyForPutRequest() {
- def request = new MockHttpServletRequest()
- request.content = 'foo=bar&one=two'.bytes
- request.method = 'PUT'
- request.contentType = "application/x-www-form-urlencoded"
-
- def params = new GrailsParameterMap(request)
+ void testFormEncodedPutBodyIsExposedAsParams() {
+ def params = new GrailsParameterMap(formFilteredRequest('PUT', 'foo=bar&one=two', 'application/x-www-form-urlencoded'))
assert 'bar' == params.foo
assert 'two' == params.one
-
- params = new GrailsParameterMap(request)
- assert params.foo == null // should be null, request can't be parsed twice
-
- request = new MockHttpServletRequest()
- request.method = 'PUT'
- request.content = 'foo='.bytes
- request.contentType = "application/x-www-form-urlencoded"
- request.removeAttribute(GrailsParameterMap.REQUEST_BODY_PARSED)
-
- params = new GrailsParameterMap(request)
-
- assert '' == params.foo
}
@Test
- void testParseRequestBodyForPutRequestWithCharset() {
- def request = new MockHttpServletRequest()
- request.content = 'foo=bar&one=two'.bytes
- request.method = 'PUT'
- request.contentType = "application/x-www-form-urlencoded; charset=UTF-8"
-
- def params = new GrailsParameterMap(request)
+ void testFormEncodedPutBodyWithCharsetIsExposedAsParams() {
+ def params = new GrailsParameterMap(formFilteredRequest('PUT', 'foo=bar&one=two', 'application/x-www-form-urlencoded; charset=UTF-8'))
assert 'bar' == params.foo
assert 'two' == params.one
-
- params = new GrailsParameterMap(request)
- assert params.foo == null // should be null, request can't be parsed twice
-
- request = new MockHttpServletRequest()
- request.method = 'PUT'
- request.contentType = "application/x-www-form-urlencoded; charset=UTF-8"
- request.content = 'foo='.bytes
- request.removeAttribute(GrailsParameterMap.REQUEST_BODY_PARSED)
Review Comment:
Since you're relying on the form filter now, you should add a functioanl test to cover these removed scenarios
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#issuecomment-4899811000
## β
All tests passed β
π·οΈ Commit: 8f14cb40fa21e53c2077a6f5c5c67b54ecaf460b
βΆοΈ Tests: 51472 executed
βͺοΈ Checks: 46/46 completed
---
_Learn more about TestLens at [testlens.app](https://testlens.app)._
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "codeconsole (via GitHub)" <gi...@apache.org>.
codeconsole commented on code in PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#discussion_r3531398072
##########
grails-controllers/build.gradle:
##########
@@ -63,6 +63,10 @@ dependencies {
testImplementation 'jakarta.servlet:jakarta.servlet-api'
testImplementation 'org.springframework:spring-test'
+ // WebApplicationContextRunner verifies Boot's WebMvcAutoConfiguration backs off its RequestContextFilter
Review Comment:
Removed in 12505aa.
##########
grails-controllers/src/main/groovy/org/grails/plugins/web/controllers/ControllersAutoConfiguration.java:
##########
@@ -108,13 +108,24 @@ public FilterRegistrationBean<Filter> hiddenHttpMethodFilter() {
return registrationBean;
}
+ // Exposed as a RequestContextFilter bean (GrailsWebRequestFilter extends it) so that Boot's
Review Comment:
Simplified in 12505aa.
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#issuecomment-4368303612
This is now been here for almost a year and half with no progress. I'm going to close the PR for now - please reopen when you feel it's ready for review.
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "codeconsole (via GitHub)" <gi...@apache.org>.
codeconsole commented on code in PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#discussion_r3553012605
##########
grails-controllers/src/main/groovy/org/grails/plugins/web/controllers/GrailsFormContentFilterAutoConfiguration.java:
##########
@@ -0,0 +1,56 @@
+/*
+ * 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.web.controllers;
+
+import org.springframework.boot.autoconfigure.AutoConfiguration;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
+import org.springframework.boot.servlet.filter.OrderedFormContentFilter;
+import org.springframework.boot.webmvc.autoconfigure.WebMvcAutoConfiguration;
+import org.springframework.context.annotation.Bean;
+import org.springframework.web.filter.FormContentFilter;
+
+/**
+ * Guarantees a {@link FormContentFilter} for every Grails servlet web application, so form-encoded
+ * {@code PUT}, {@code PATCH} and {@code DELETE} bodies are parsed into request parameters and are
Review Comment:
Done in 5c4974389b β the auto-config javadoc and the upgrade notes (section 31.4) now state explicitly that the filter only affects `application/x-www-form-urlencoded` bodies; JSON and multipart bodies are untouched and remain available to data binding.
##########
grails-core/src/main/groovy/grails/config/Settings.groovy:
##########
@@ -270,6 +270,13 @@ interface Settings {
*/
String WEB_REMOVE_DEFAULT_VIEW_RESOLVER_BEAN = 'grails.web.removeDefaultViewResolverBean'
+ /**
+ * Whether to remove Spring Boot's welcome-page handler mappings so Grails' own URL mappings
+ * own the root path ('/') rather than a static {@code index.html} being served for it.
+ * Defaults to true
+ */
+ String WEB_REMOVE_WELCOME_PAGE_MAPPING = 'grails.web.removeWelcomePageMapping'
Review Comment:
Done in 5c4974389b β added `grails.web.removeDefaultViewResolverBean`, `grails.web.removeWelcomePageMapping`, and `grails.i18n.localeResolver` (with value hints) to `additional-spring-configuration-metadata.json`.
##########
grails-doc/src/en/guide/upgrading/upgrading80x.adoc:
##########
@@ -1396,6 +1396,31 @@ Grails 8 registers its request-binding filter as a `RequestContextFilter` bean s
This is handled internally and requires no configuration changes.
Applications that defined their own `GrailsWebRequestFilter` bean, or their own `grailsWebRequestFilter` filter-registration bean, continue to override the Grails-provided ones.
+===== 31.3 Other Boot MVC features now active
+
+Because Boot's `WebMvcAutoConfiguration` is now active, a handful of its features that `@EnableWebMvc` previously suppressed take effect for Grails servlet web applications.
+None require action for a typical application, but they are behavioral differences worth knowing about when you upgrade:
+
+* **Form-content filter for `PUT` / `PATCH` / `DELETE`.** A `FormContentFilter` parses `application/x-www-form-urlencoded` bodies of `PUT`, `PATCH` and `DELETE` requests so their fields are visible through the standard `request.getParameter(...)` API (and therefore in `params`). Boot's `OrderedFormContentFilter` provides it for a default application; for an application that declares `@EnableWebMvc` β where Boot's MVC auto-configuration backs off β Grails contributes an equivalent filter itself, so form parameters behave the same either way. In Grails 7 only `PUT` and `PATCH` bodies were parsed (by `GrailsParameterMap`) and `DELETE` was not; all three are now handled uniformly by the filter. It is enabled by default via `spring.mvc.formcontent.filter.enabled`; setting that to `false` disables `PUT` / `PATCH` / `DELETE` form-parameter parsing entirely. An application that reads those bodies itself can disable it:
++
+[source,yaml]
+.application.yml
+----
+spring:
+ mvc:
+ formcontent:
+ filter:
+ enabled: false
+----
+
+* **`spring.mvc.*` and `spring.web.*` properties now apply.** Properties such as `spring.web.locale`, `spring.mvc.format.date` / `time` / `date-time`, and `spring.web.resources.*` were inert before and now take effect. Review any of these you may have set inadvertently (for example copied from Boot documentation).
+
+* **Boot static-resource handling and welcome page.** Boot adds a catch-all resource handler (`classpath:/META-INF/resources/`, `/resources/`, `/static/`, `/public/`) and a `WelcomePageHandlerMapping` for a static `index.html`, alongside Grails' own resource handling. A request that previously fell through to Grails' URL-mapping error handling may now be served as a static resource or welcome page β worth checking in applications with catch-all URL mappings or custom 404 handling. Set `spring.web.resources.add-mappings: false` to disable the static-resource handler.
Review Comment:
Updated in 5c4974389b. Static resources and the welcome page are now their own subsection (31.3) documenting that Grails removes them by default β they were incorrectly listed as now active. The remaining Boot MVC features moved to 31.4, and a new 31.5 covers locale resolution. Also fixed the stale "two behavioral differences".
##########
grails-doc/src/en/guide/i18n/changingLocales.adoc:
##########
@@ -28,7 +28,19 @@ Grails will automatically switch the user's locale and subsequent requests will
By default, Grails uses {springapi}org/springframework/web/servlet/i18n/SessionLocaleResolver.html[SessionLocaleResolver] as the `localeResolver` bean.
-You can change the default locale easily:
+You can select a different resolver strategy with the `grails.i18n.localeResolver` configuration property, without declaring a bean:
+
+[source,yaml]
+.grails-app/conf/application.yml
+----
+grails:
+ i18n:
+ localeResolver: acceptHeader # session (default), cookie, acceptHeader or fixed
+----
+
+`session` and `cookie` are mutable, so the `?lang=` switch works with them. `acceptHeader` (the locale follows the incoming `Accept-Language` header) and `fixed` are read-only, so the `?lang=` switch has no effect and is silently ignored. The `fixed` resolver uses `grails.i18n.default.locale`, falling back to the JVM default locale.
Review Comment:
With the default `session` resolver (and `cookie`), the `?lang=` URL parameter overrides the `Accept-Language` header and is remembered for subsequent requests. With `acceptHeader` and `fixed` the resolver is read-only, so the header (or the fixed locale) wins and `?lang=` is ignored. Spelled this out in the doc in 5c4974389b.
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#issuecomment-4919363507
## π¨ TestLens detected 1 failed test π¨
Here is what you can do:
1) Inspect the test failures carefully.
2) If you are convinced that some of the tests are flaky, you can mute them below.
3) Finally, trigger a rerun by checking the rerun checkbox.
### Test Summary
#### [CI - Groovy Joint Validation Build / build\_grails](https://github.com/apache/grails-core/actions/runs/28971832808/job/85969729639?pr=13863) > :grails-test-examples-app1:integrationTest
| Test | Runs | Flakiness |
|---|---|--:|
| AsyncPromiseSpec > async task with timeout completes within time limit > async task with timeout completes within time limit [delay: 100, timeout: 500, elapsedMin: 100, status: completed, result: Completed in time, \#0] | β | 0% π’ |
π·οΈ Commit: 7089adbb9c73d018d5274fa951bcbb93695e3882
βΆοΈ Tests: 47827 executed
π‘ Checks: 51/54 completed
### Test Failures
<details>
<summary><strong>AsyncPromiseSpec > async task with timeout completes within time limit > async task with timeout completes within time limit [delay: 100, timeout: 500, elapsedMin: 100, status: completed, result: Completed in time, #0]</strong> (:grails-test-examples-app1:integrationTest in <a href="https://github.com/apache/grails-core/actions/runs/28971832808/job/85969729639?pr=13863">CI - Groovy Joint Validation Build / build_grails</a>)</summary>
```
java.net.http.HttpTimeoutException: request timed out
at java.net.http/jdk.internal.net.http.HttpClientImpl.send(HttpClientImpl.java:953)
at java.net.http/jdk.internal.net.http.HttpClientFacade.send(HttpClientFacade.java:133)
at org.apache.grails.testing.http.client.HttpClientSupport$Trait$Helper.send(HttpClientSupport.groovy:1133)
at org.apache.grails.testing.http.client.HttpClientSupport$Trait$Helper.send(HttpClientSupport.groovy:1122)
at org.apache.grails.testing.http.client.HttpClientSupport$Trait$Helper.http(HttpClientSupport.groovy:203)
at org.apache.grails.testing.http.client.HttpClientSupport$Trait$Helper.http(HttpClientSupport.groovy:169)
at functionaltests.async.AsyncPromiseSpec.async task with timeout completes within time limit(AsyncPromiseSpec.groovy:116)
```
</details>
### Muted Tests
> [!NOTE]
> Checks are currently running using the configuration below.
Select tests to mute in this pull request:
π² AsyncPromiseSpec > async task with timeout completes within time limit <!-- uniqueId=[engine:spock]/[spec:functionaltests.async.AsyncPromiseSpec]/[feature:$spock_feature_0_5] -->
Reuse successful test results:
π² β»οΈ Only rerun the tests that failed or were muted before
Click the checkbox to trigger a rerun:
π² **Rerun jobs**
---
_Learn more about TestLens at [testlens.app](https://testlens.app)._
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#issuecomment-4907170635
## π¨ TestLens detected 1 failed test π¨
Here is what you can do:
1) Inspect the test failures carefully.
2) If you are convinced that some of the tests are flaky, you can mute them below.
3) Finally, trigger a rerun by checking the rerun checkbox.
### Test Summary
#### [CI / Build Grails Forge \(Java 21, indy\=false\)](https://github.com/apache/grails-core/actions/runs/28887293688/job/85690709754?pr=13863) > :test-core:test [grails-forge]
| Test | Runs |
|---|---|
| CreateRestApiSpec > test rest-api app with default json-views | β |
π·οΈ Commit: 84ea8179b8d948e0f387ee9f478083a1b3cd761e
βΆοΈ Tests: 12297 executed
π‘ Checks: 23/55 completed
### Test Failures
<details>
<summary><strong>CreateRestApiSpec > test rest-api app with default json-views</strong> (:test-core:test [grails-forge] in <a href="https://github.com/apache/grails-core/actions/runs/28887293688/job/85690709754?pr=13863">CI / Build Grails Forge (Java 21, indy=false)</a>)</summary>
```
org.gradle.testkit.runner.UnexpectedBuildFailure: Unexpected build execution failure in /tmp/testrestapi15001357302768000549 with arguments [build]
Output:
[Incubating] Problems report is available at: file:///tmp/testrestapi15001357302768000549/build/reports/problems/problems-report.html
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'testrestapi15001357302768000549'.
> Failed to notify project evaluation listener.
> org/codehaus/plexus/util/xml/pull/XmlPullParserException
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights from a Build Scan (powered by Develocity).
> Get more help at https://help.gradle.org.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 10.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/9.6.0/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 43s
at org.gradle.testkit.runner.internal.DefaultGradleRunner.lambda$build$2(DefaultGradleRunner.java:275)
at org.gradle.testkit.runner.internal.DefaultGradleRunner.run(DefaultGradleRunner.java:374)
at org.gradle.testkit.runner.internal.DefaultGradleRunner.build(DefaultGradleRunner.java:273)
at org.grails.forge.utils.CommandSpec.executeGradle(CommandSpec.groovy:79)
at org.grails.forge.create.CreateRestApiSpec.test rest-api app with default json-views(CreateRestApiSpec.groovy:30)
```
</details>
### Muted Tests
> [!NOTE]
> Checks are currently running using the configuration below.
Select tests to mute in this pull request:
π² CreateRestApiSpec > test rest-api app with default json-views <!-- uniqueId=[engine:spock]/[spec:org.grails.forge.create.CreateRestApiSpec]/[feature:$spock_feature_1_0] -->
Reuse successful test results:
π² β»οΈ Only rerun the tests that failed or were muted before
Click the checkbox to trigger a rerun:
π² **Rerun jobs**
---
_Learn more about TestLens at [testlens.app](https://testlens.app)._
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#issuecomment-4922109714
## β
All tests passed β
π·οΈ Commit: c23e1c63b72e5a943c017bed6c603f09b3e615b6
βΆοΈ Tests: 61155 executed
βͺοΈ Checks: 61/61 completed
---
_Learn more about TestLens at [testlens.app](https://testlens.app)._
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#issuecomment-4765929742
## π¨ TestLens detected 4 failed tests π¨
Here is what you can do:
1) Inspect the test failures carefully.
2) If you are convinced that some of the tests are flaky, you can mute them below.
3) Finally, trigger a rerun by checking the rerun checkbox.
### Test Summary
#### [CI / Functional Tests \(Java 21, indy\=false\)](https://github.com/apache/grails-core/actions/runs/27935414170/job/82655882865?pr=13863) > :grails-test-examples-graphql-grails-docs-app:integrationTest
| Test | Runs |
|---|---|
| AuthorIntegrationSpec > test creating an author | β |
| SpeakerIntegrationSpec > test creating a speaker | β |
#### [CI / Functional Tests \(Java 25, indy\=false\)](https://github.com/apache/grails-core/actions/runs/27935414170/job/82655883098?pr=13863) > :grails-test-examples-graphql-grails-docs-app:integrationTest
| Test | Runs |
|---|---|
| AuthorIntegrationSpec > test creating an author | β |
| SpeakerIntegrationSpec > test creating a speaker | β |
π·οΈ Commit: b05894e5e76650aa575696dab359d8df83c8c2ab
βΆοΈ Tests: 24090 executed
π‘ Checks: 22/38 completed
### Test Failures
<details>
<summary><strong>AuthorIntegrationSpec > test creating an author</strong> (:grails-test-examples-graphql-grails-docs-app:integrationTest in <a href="https://github.com/apache/grails-core/actions/runs/27935414170/job/82655882865?pr=13863">CI / Functional Tests (Java 21, indy=false)</a>)</summary>
```
Condition failed with Exception:
JsonOutput.prettyPrint(process.text) == """ // tag::createResponse[] { "data": { "authorCreate": { "id": 1, "name": "Sally", "homeLocation": { "lat": "41.101539", "long": "-80.653381" }, "books": [ { "key": "0743264746", "value": { "id": 1, "title": "Einstein: His Life and Universe" } }, { "key": "0307887448", "value": { "id": 2, "title": "Ready Player One" } } ], "errors": [ ] } } } // end::createResponse[] """.replace('\n// tag::createResponse[]\n', '') .replace('\n// end::createResponse[]\n', '')
| | | |
| | | <!doctype html><html lang="en"><head><title>HTTP Status 500 β Internal Server Error</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 500 β Internal Server Error</h1></body></html>
| | Process[pid=26368, exitValue=126]
| groovy.json.JsonException: Lexing failed on line: 1, column: 1, while reading '<', no possible valid JSON value or punctuation could be recognized.
| at groovy.json.JsonLexer.nextToken(JsonLexer.java:86)
| at groovy.json.JsonLexer.hasNext(JsonLexer.java:240)
| at groovy.json.JsonOutput.prettyPrint(JsonOutput.java:182)
| at groovy.json.JsonOutput.prettyPrint(JsonOutput.java:163)
| at demo.AuthorIntegrationSpec.test creating an author(AuthorIntegrationSpec.groovy:79)
class groovy.json.JsonOutput
at demo.AuthorIntegrationSpec.test creating an author(AuthorIntegrationSpec.groovy:115)
Caused by: groovy.json.JsonException: Lexing failed on line: 1, column: 1, while reading '<', no possible valid JSON value or punctuation could be recognized.
at groovy.json.JsonLexer.nextToken(JsonLexer.java:86)
at groovy.json.JsonLexer.hasNext(JsonLexer.java:240)
at groovy.json.JsonOutput.prettyPrint(JsonOutput.java:182)
at groovy.json.JsonOutput.prettyPrint(JsonOutput.java:163)
at demo.AuthorIntegrationSpec.test creating an author(AuthorIntegrationSpec.groovy:79)
```
</details>
<details>
<summary><strong>SpeakerIntegrationSpec > test creating a speaker</strong> (:grails-test-examples-graphql-grails-docs-app:integrationTest in <a href="https://github.com/apache/grails-core/actions/runs/27935414170/job/82655882865?pr=13863">CI / Functional Tests (Java 21, indy=false)</a>)</summary>
```
Condition failed with Exception:
JsonOutput.prettyPrint(process.text) == """ // tag::response[] { "data": { "speakerCreate": { "id": 8, "firstName": "James", "lastName": "Kleeh", "errors": [ ] } } } // end::response[] """.replace('\n// tag::response[]\n', '') .replace('\n// end::response[]\n', '')
| | | |
| | | <!doctype html><html lang="en"><head><title>HTTP Status 500 β Internal Server Error</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 500 β Internal Server Error</h1></body></html>
| | Process[pid=26806, exitValue=126]
| groovy.json.JsonException: Lexing failed on line: 1, column: 1, while reading '<', no possible valid JSON value or punctuation could be recognized.
| at groovy.json.JsonLexer.nextToken(JsonLexer.java:86)
| at groovy.json.JsonLexer.hasNext(JsonLexer.java:240)
| at groovy.json.JsonOutput.prettyPrint(JsonOutput.java:182)
| at groovy.json.JsonOutput.prettyPrint(JsonOutput.java:163)
| at demo.SpeakerIntegrationSpec.test creating a speaker(SpeakerIntegrationSpec.groovy:62)
class groovy.json.JsonOutput
at demo.SpeakerIntegrationSpec.test creating a speaker(SpeakerIntegrationSpec.groovy:79)
Caused by: groovy.json.JsonException: Lexing failed on line: 1, column: 1, while reading '<', no possible valid JSON value or punctuation could be recognized.
at groovy.json.JsonLexer.nextToken(JsonLexer.java:86)
at groovy.json.JsonLexer.hasNext(JsonLexer.java:240)
at groovy.json.JsonOutput.prettyPrint(JsonOutput.java:182)
at groovy.json.JsonOutput.prettyPrint(JsonOutput.java:163)
at demo.SpeakerIntegrationSpec.test creating a speaker(SpeakerIntegrationSpec.groovy:62)
```
</details>
<details>
<summary><strong>AuthorIntegrationSpec > test creating an author</strong> (:grails-test-examples-graphql-grails-docs-app:integrationTest in <a href="https://github.com/apache/grails-core/actions/runs/27935414170/job/82655883098?pr=13863">CI / Functional Tests (Java 25, indy=false)</a>)</summary>
```
Condition failed with Exception:
JsonOutput.prettyPrint(process.text) == """ // tag::createResponse[] { "data": { "authorCreate": { "id": 1, "name": "Sally", "homeLocation": { "lat": "41.101539", "long": "-80.653381" }, "books": [ { "key": "0743264746", "value": { "id": 1, "title": "Einstein: His Life and Universe" } }, { "key": "0307887448", "value": { "id": 2, "title": "Ready Player One" } } ], "errors": [ ] } } } // end::createResponse[] """.replace('\n// tag::createResponse[]\n', '') .replace('\n// end::createResponse[]\n', '')
| | | |
| | | <!doctype html><html lang="en"><head><title>HTTP Status 500 β Internal Server Error</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 500 β Internal Server Error</h1></body></html>
| | Process[pid=27448, exitValue=126]
| groovy.json.JsonException: Lexing failed on line: 1, column: 1, while reading '<', no possible valid JSON value or punctuation could be recognized.
| at groovy.json.JsonLexer.nextToken(JsonLexer.java:86)
| at groovy.json.JsonLexer.hasNext(JsonLexer.java:240)
| at groovy.json.JsonOutput.prettyPrint(JsonOutput.java:182)
| at groovy.json.JsonOutput.prettyPrint(JsonOutput.java:163)
| at demo.AuthorIntegrationSpec.test creating an author(AuthorIntegrationSpec.groovy:79)
class groovy.json.JsonOutput
at demo.AuthorIntegrationSpec.test creating an author(AuthorIntegrationSpec.groovy:115)
Caused by: groovy.json.JsonException: Lexing failed on line: 1, column: 1, while reading '<', no possible valid JSON value or punctuation could be recognized.
at groovy.json.JsonLexer.nextToken(JsonLexer.java:86)
at groovy.json.JsonLexer.hasNext(JsonLexer.java:240)
at groovy.json.JsonOutput.prettyPrint(JsonOutput.java:182)
at groovy.json.JsonOutput.prettyPrint(JsonOutput.java:163)
at demo.AuthorIntegrationSpec.test creating an author(AuthorIntegrationSpec.groovy:79)
```
</details>
<details>
<summary><strong>SpeakerIntegrationSpec > test creating a speaker</strong> (:grails-test-examples-graphql-grails-docs-app:integrationTest in <a href="https://github.com/apache/grails-core/actions/runs/27935414170/job/82655883098?pr=13863">CI / Functional Tests (Java 25, indy=false)</a>)</summary>
```
Condition failed with Exception:
JsonOutput.prettyPrint(process.text) == """ // tag::response[] { "data": { "speakerCreate": { "id": 8, "firstName": "James", "lastName": "Kleeh", "errors": [ ] } } } // end::response[] """.replace('\n// tag::response[]\n', '') .replace('\n// end::response[]\n', '')
| | | |
| | | <!doctype html><html lang="en"><head><title>HTTP Status 500 β Internal Server Error</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 500 β Internal Server Error</h1></body></html>
| | Process[pid=27641, exitValue=126]
| groovy.json.JsonException: Lexing failed on line: 1, column: 1, while reading '<', no possible valid JSON value or punctuation could be recognized.
| at groovy.json.JsonLexer.nextToken(JsonLexer.java:86)
| at groovy.json.JsonLexer.hasNext(JsonLexer.java:240)
| at groovy.json.JsonOutput.prettyPrint(JsonOutput.java:182)
| at groovy.json.JsonOutput.prettyPrint(JsonOutput.java:163)
| at demo.SpeakerIntegrationSpec.test creating a speaker(SpeakerIntegrationSpec.groovy:62)
class groovy.json.JsonOutput
at demo.SpeakerIntegrationSpec.test creating a speaker(SpeakerIntegrationSpec.groovy:79)
Caused by: groovy.json.JsonException: Lexing failed on line: 1, column: 1, while reading '<', no possible valid JSON value or punctuation could be recognized.
at groovy.json.JsonLexer.nextToken(JsonLexer.java:86)
at groovy.json.JsonLexer.hasNext(JsonLexer.java:240)
at groovy.json.JsonOutput.prettyPrint(JsonOutput.java:182)
at groovy.json.JsonOutput.prettyPrint(JsonOutput.java:163)
at demo.SpeakerIntegrationSpec.test creating a speaker(SpeakerIntegrationSpec.groovy:62)
```
</details>
### Muted Tests
> [!NOTE]
> Checks are currently running using the configuration below.
Select tests to mute in this pull request:
π² AuthorIntegrationSpec > test creating an author <!-- uniqueId=[engine:spock]/[spec:demo.AuthorIntegrationSpec]/[feature:$spock_feature_0_0] -->
π² SpeakerIntegrationSpec > test creating a speaker <!-- uniqueId=[engine:spock]/[spec:demo.SpeakerIntegrationSpec]/[feature:$spock_feature_0_0] -->
Reuse successful test results:
π² β»οΈ Only rerun the tests that failed or were muted before
Click the checkbox to trigger a rerun:
π² **Rerun jobs**
---
_Learn more about TestLens at [testlens.app](https://testlens.app)._
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#issuecomment-4771335531
## β
All tests passed β
π·οΈ Commit: 04622e3a9cfbd920089329aa6436c6c90f050ca9
βΆοΈ Tests: 47760 executed
βͺοΈ Checks: 46/46 completed
---
_Learn more about TestLens at [testlens.app](https://testlens.app)._
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "codeconsole (via GitHub)" <gi...@apache.org>.
codeconsole commented on PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#issuecomment-4918278703
Thanks @jdaugherty (and Fabled) β both are spot on, and I've updated this PR to address them.
Quick context on the diff: the original `@EnableWebMvc` removal already landed on `8.0.x` when #15916 merged this branch, so the diff GitHub renders here (computed against the old merge base) overstates what's actually new. I've merged current `8.0.x` back in and added the two follow-ups on top, so the real delta this PR now carries is just those fixes.
**1. Undocumented `WebMvcAutoConfiguration` side effects β documented.** Added a new "31.3 Other Boot MVC features now active" subsection to the upgrade notes covering:
- `OrderedFormContentFilter` (default-on via `spring.mvc.formcontent.filter.enabled`) β PUT/PATCH/DELETE form-encoded bodies now surface as request parameters.
- `spring.mvc.*` / `spring.web.*` properties now taking effect (`spring.web.locale`, `spring.mvc.format.*`, `spring.web.resources.*`, β¦).
- Boot's `/**` static-resource handler + `WelcomePageHandlerMapping`, and their effect on 404 / catch-all URL-mapping behavior (with the `spring.web.resources.add-mappings` opt-out).
- `viewResolver` now `ContentNegotiatingViewResolver` for non-GSP apps (GSP unchanged).
- `mvcConversionService` now `ApplicationConversionService`, plus Boot's message-converter customization.
**2. `grailsWebRequest` double-registration β fixed.** Gated the raw `grailsWebRequest` bean on `@ConditionalOnMissingBean(value = GrailsWebRequestFilter.class, name = "grailsWebRequestFilter")`. When an application overrides only the registration bean, the raw filter now backs off with it rather than lingering unwrapped for Boot to auto-register on `/*` at `LOWEST_PRECEDENCE`. In the default case the raw bean stays a top-level `RequestContextFilter`, so Boot's own `RequestContextFilter` still backs off exactly as before.
And you're right that the old override test only checked bean identity β I reworked it to assemble the real servlet chain via `ServletContextInitializerBeans` and assert against it: the override case verifies no stray `GrailsWebRequestFilter` lands on the chain, and the default case verifies exactly one does. Both new assertions fail without the gating fix (confirmed by reverting it).
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "codeconsole (via GitHub)" <gi...@apache.org>.
codeconsole commented on PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#issuecomment-4925568550
## Follow-on changes: neutralizing the Boot MVC defaults exposed by removing `@EnableWebMvc`
Removing the auto-injected `@EnableWebMvc` means Spring Boot's `WebMvcAutoConfiguration` is now active (and Spring's `WebMvcConfigurationSupport` no longer owns MVC config). That's the goal β Grails participates in the Boot auto-configuration ecosystem β but it also switches on a handful of Boot / Spring MVC defaults that overlap with, or silently change, long-standing Grails behavior. These commits keep the pieces Grails should own while letting the rest of `WebMvcAutoConfiguration` through.
### 1. Static resources β don't serve `classpath:/public` at the context root
`WebMvcAutoConfiguration` registers a catchβall `/**` resource handler over `classpath:/META-INF/resources/`, `classpath:/resources/`, `classpath:/static/` and `classpath:/public/`. Grails already serves those exact locations under `/static/**` (`ControllersAutoConfiguration.GrailsWebMvcConfigurer`), so Boot's `/**` is both redundant and a behavior change: any unmapped URL can now be shadowed by a file under `classpath:/public` where it previously 404'd.
- **`GrailsWebResourcesEnvironmentPostProcessor`** contributes `spring.web.resources.add-mappings=false` as an overridable default, so Boot's catchβall is off while Grails' own `/static/**` serving (gated by `grails.resources.enabled`) is unaffected. Apps that want Boot's behavior set `spring.web.resources.add-mappings=true`.
### 2. Welcome page β Grails' `UrlMappings` own `/`
`WebMvcAutoConfiguration` also registers `welcomePageHandlerMapping` / `welcomePageNotAcceptableHandlerMapping`, which serve a static `index.html` at `/`. That overlaps with Grails' `UrlMappings`-based root handling and can shadow an application's own `"/"` mapping whenever such an `index.html` happens to be on the classpath.
- **`GrailsWelcomePageAutoConfiguration`** removes both welcome-page mappings so the root path falls through to `UrlMappings`. Opt out with `grails.web.removeWelcomePageMapping=false`.
### 3. Locale resolution β `?lang=` regressed silently under `@EnableWebMvc`
The most subtle one. In **Spring Framework 7, `WebMvcConfigurationSupport` now contributes its own `localeResolver` bean** (an `AcceptHeaderLocaleResolver`). Because `@EnableWebMvc` imports `WebMvcConfigurationSupport`, that bean exists *before* `I18nAutoConfiguration` is evaluated, so grails-i18n's `@ConditionalOnMissingBean(name = "localeResolver")` backed off β Grails' `SessionLocaleResolver` never registered and **`?lang=` locale switching silently stopped working**. Worse, `ParamsAwareLocaleChangeInterceptor` still ran and logged an `UnsupportedOperationException` from `AcceptHeaderLocaleResolver.setLocale` on every `?lang=` request.
This is a regression from Grails 7: on 7.2.x `I18nAutoConfiguration.localeResolver()` registered the `SessionLocaleResolver` **unconditionally**, so it always took precedence even with the auto-injected `@EnableWebMvc`. (Confirmed empirically: dropping the `@ConditionalOnMissingBean` restores `?lang=de` β `de`; keeping it yields the `Accept-Language` header value.)
Fixes:
- **`GrailsLocaleResolverAutoConfiguration`** (ordered before `I18nAutoConfiguration`) removes *only* the `WebMvcConfigurationSupport`-contributed `localeResolver`, identified by its factory-bean type, so grails-i18n's configured resolver registers instead. An application-defined `localeResolver` (from `resources.groovy` or a user `@Configuration`) is left untouched, so an explicit app resolver still wins.
- **`grails.i18n.localeResolver` is now configurable** β `session` (default), `cookie`, `acceptHeader`, or `fixed`. Header-based resolution is a clean optβin for apps that prefer it; `acceptHeader`/`fixed` are read-only, so `?lang=` simply has no effect with them.
- **`ParamsAwareLocaleChangeInterceptor`** now handles a read-only resolver gracefully β it logs the unsupported `setLocale` at debug rather than erroring on every request. The interceptor stays registered (so `urlMappingsHandlerMapping` keeps its required `HandlerInterceptor`); it just no-ops when the resolver can't change.
### Tests & docs
- Unit coverage: `GrailsWelcomePageAutoConfigurationSpec`, `GrailsWebResourcesEnvironmentPostProcessorSpec`, `GrailsLocaleResolverAutoConfigurationSpec`, updated `I18nAutoConfigurationSpec`, and a read-only-resolver case in `ParamsAwareLocaleChangeInterceptorTests`.
- The `enable-mvc-check` integration app exercises all of the above end-to-end (`classpath:/public` 404, welcome-page 404, form-content parsing, and β via `grails.i18n.localeResolver=acceptHeader` β header-based locale resolution with no error spam).
- `changingLocales.adoc` documents the new `grails.i18n.localeResolver` property.
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#issuecomment-4919091540
I missed the dependency when the other PR was merged. I don't think we want these values registered and instead of docuemnting we need to disable them.
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "codeconsole (via GitHub)" <gi...@apache.org>.
codeconsole commented on code in PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#discussion_r3553013952
##########
grails-test-examples/enable-mvc-check/README.md:
##########
@@ -0,0 +1,62 @@
+<!--
+SPDX-License-Identifier: Apache-2.0
+
+Licensed 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.
+-->
+
+# enable-mvc-check
+
+A dedicated Grails functional test application that pins down the behavior of
Review Comment:
Removed in 5c4974389b.
##########
grails-web-common/src/test/groovy/grails/web/servlet/mvc/GrailsParameterMapTests.groovy:
##########
@@ -92,82 +97,47 @@ class GrailsParameterMapTests {
}
@Test
- void testParseRequestBodyForPutRequest() {
- def request = new MockHttpServletRequest()
- request.content = 'foo=bar&one=two'.bytes
- request.method = 'PUT'
- request.contentType = "application/x-www-form-urlencoded"
-
- def params = new GrailsParameterMap(request)
+ void testFormEncodedPutBodyIsExposedAsParams() {
+ def params = new GrailsParameterMap(formFilteredRequest('PUT', 'foo=bar&one=two', 'application/x-www-form-urlencoded'))
assert 'bar' == params.foo
assert 'two' == params.one
-
- params = new GrailsParameterMap(request)
- assert params.foo == null // should be null, request can't be parsed twice
-
- request = new MockHttpServletRequest()
- request.method = 'PUT'
- request.content = 'foo='.bytes
- request.contentType = "application/x-www-form-urlencoded"
- request.removeAttribute(GrailsParameterMap.REQUEST_BODY_PARSED)
-
- params = new GrailsParameterMap(request)
-
- assert '' == params.foo
}
@Test
- void testParseRequestBodyForPutRequestWithCharset() {
- def request = new MockHttpServletRequest()
- request.content = 'foo=bar&one=two'.bytes
- request.method = 'PUT'
- request.contentType = "application/x-www-form-urlencoded; charset=UTF-8"
-
- def params = new GrailsParameterMap(request)
+ void testFormEncodedPutBodyWithCharsetIsExposedAsParams() {
+ def params = new GrailsParameterMap(formFilteredRequest('PUT', 'foo=bar&one=two', 'application/x-www-form-urlencoded; charset=UTF-8'))
assert 'bar' == params.foo
assert 'two' == params.one
-
- params = new GrailsParameterMap(request)
- assert params.foo == null // should be null, request can't be parsed twice
-
- request = new MockHttpServletRequest()
- request.method = 'PUT'
- request.contentType = "application/x-www-form-urlencoded; charset=UTF-8"
- request.content = 'foo='.bytes
- request.removeAttribute(GrailsParameterMap.REQUEST_BODY_PARSED)
Review Comment:
Added in 5c4974389b β a `FormContentFunctionalSpec` in `app1` (a default, non-@EnableWebMvc app) asserts that form-encoded `PUT`, `PATCH` and `DELETE` (and `POST`) bodies are parsed into `params` via Boot OrderedFormContentFilter, covering these removed unit scenarios end-to-end.
##########
grails-web-common/src/test/groovy/grails/web/servlet/mvc/GrailsParameterMapTests.groovy:
##########
@@ -92,82 +97,47 @@ class GrailsParameterMapTests {
}
@Test
- void testParseRequestBodyForPutRequest() {
- def request = new MockHttpServletRequest()
- request.content = 'foo=bar&one=two'.bytes
- request.method = 'PUT'
- request.contentType = "application/x-www-form-urlencoded"
-
- def params = new GrailsParameterMap(request)
+ void testFormEncodedPutBodyIsExposedAsParams() {
+ def params = new GrailsParameterMap(formFilteredRequest('PUT', 'foo=bar&one=two', 'application/x-www-form-urlencoded'))
assert 'bar' == params.foo
assert 'two' == params.one
-
- params = new GrailsParameterMap(request)
- assert params.foo == null // should be null, request can't be parsed twice
-
- request = new MockHttpServletRequest()
- request.method = 'PUT'
- request.content = 'foo='.bytes
- request.contentType = "application/x-www-form-urlencoded"
- request.removeAttribute(GrailsParameterMap.REQUEST_BODY_PARSED)
-
- params = new GrailsParameterMap(request)
-
- assert '' == params.foo
}
@Test
- void testParseRequestBodyForPutRequestWithCharset() {
- def request = new MockHttpServletRequest()
- request.content = 'foo=bar&one=two'.bytes
- request.method = 'PUT'
- request.contentType = "application/x-www-form-urlencoded; charset=UTF-8"
-
- def params = new GrailsParameterMap(request)
+ void testFormEncodedPutBodyWithCharsetIsExposedAsParams() {
+ def params = new GrailsParameterMap(formFilteredRequest('PUT', 'foo=bar&one=two', 'application/x-www-form-urlencoded; charset=UTF-8'))
assert 'bar' == params.foo
assert 'two' == params.one
-
- params = new GrailsParameterMap(request)
- assert params.foo == null // should be null, request can't be parsed twice
-
- request = new MockHttpServletRequest()
- request.method = 'PUT'
- request.contentType = "application/x-www-form-urlencoded; charset=UTF-8"
- request.content = 'foo='.bytes
- request.removeAttribute(GrailsParameterMap.REQUEST_BODY_PARSED)
-
- params = new GrailsParameterMap(request)
-
- assert '' == params.foo
}
@Test
- void testParseRequestBodyForPatchRequest() {
- def request = new MockHttpServletRequest()
- request.content = 'foo=bar&one=two'.bytes
- request.method = 'PATCH'
- request.contentType = "application/x-www-form-urlencoded"
-
- def params = new GrailsParameterMap(request)
+ void testFormEncodedPatchBodyIsExposedAsParams() {
+ def params = new GrailsParameterMap(formFilteredRequest('PATCH', 'foo=bar&one=two', 'application/x-www-form-urlencoded'))
assert 'bar' == params.foo
assert 'two' == params.one
+ }
- params = new GrailsParameterMap(request)
- assert params.foo == null // should be null, request can't be parsed twice
-
- request = new MockHttpServletRequest()
Review Comment:
Same as above β covered by the new `FormContentFunctionalSpec` in `app1` (5c4974389b).
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on code in PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#discussion_r3554612499
##########
grails-controllers/src/main/groovy/org/grails/plugins/web/controllers/GrailsFormContentFilterAutoConfiguration.java:
##########
@@ -0,0 +1,87 @@
+/*
+ * 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.web.controllers;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.springframework.boot.autoconfigure.AutoConfiguration;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
+import org.springframework.boot.servlet.filter.OrderedFormContentFilter;
+import org.springframework.boot.webmvc.autoconfigure.WebMvcAutoConfiguration;
+import org.springframework.context.annotation.Bean;
+import org.springframework.web.filter.FormContentFilter;
+
+/**
+ * Guarantees a {@link FormContentFilter} for every Grails servlet web application, so
+ * {@code application/x-www-form-urlencoded} bodies of {@code PUT}, {@code PATCH} and {@code DELETE}
+ * requests are parsed into request parameters and are visible through the standard
+ * {@code request.getParameter(...)} API. Only that content type is affected β other request bodies
+ * (JSON, multipart, etc.) are untouched and remain available to data binding.
+ *
+ * Spring Boot's {@link WebMvcAutoConfiguration} already contributes an {@code OrderedFormContentFilter}
+ * for a default Grails application, in which case this auto-configuration backs off. It only fills the
+ * gap when Boot's is absent β most notably when the application declares {@code @EnableWebMvc}, which
+ * backs off the whole {@link WebMvcAutoConfiguration}. Grails supplies the filter itself so that form
+ * parsing does not depend on Boot's MVC auto-configuration being active.
+ *
+ * <p>Ordered after {@link WebMvcAutoConfiguration} so Boot's filter, when present, takes precedence and
+ * this one backs off via {@link ConditionalOnMissingBean}. The explicit opt-out
+ * {@code spring.mvc.formcontent.filter.enabled=false} disables the filter here just as it does for Boot,
+ * so it remains a true off-switch rather than something Grails silently re-enables.
+ */
+@AutoConfiguration(after = WebMvcAutoConfiguration.class)
+@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
+public class GrailsFormContentFilterAutoConfiguration {
+
+ private static final Logger logger = LoggerFactory.getLogger(GrailsFormContentFilterAutoConfiguration.class);
+
+ @Bean
+ @ConditionalOnMissingBean(FormContentFilter.class)
+ @ConditionalOnBooleanProperty(name = "spring.mvc.formcontent.filter.enabled", matchIfMissing = true)
+ public OrderedFormContentFilter formContentFilter() {
Review Comment:
Spring Security ran this before the interceptor filter, is this still the case now?
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on code in PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#discussion_r3554603813
##########
grails-test-examples/spring-security/core/integration-test-app/src/integration-test/groovy/grails/plugin/springsecurity/SpringSecurityUtilsIntegrationSpec.groovy:
##########
@@ -89,15 +87,14 @@ class SpringSecurityUtilsIntegrationSpec extends AbstractIntegrationSpec {
def map = SpringSecurityUtils.configuredOrderedFilters
expect:
- 10 == map.size()
+ 9 == map.size()
Review Comment:
So are we sure the form filter being registered by Grails is ordered before the security interceptor filter?
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on code in PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#discussion_r3526438957
##########
grails-controllers/build.gradle:
##########
@@ -63,6 +63,10 @@ dependencies {
testImplementation 'jakarta.servlet:jakarta.servlet-api'
testImplementation 'org.springframework:spring-test'
+ // WebApplicationContextRunner verifies Boot's WebMvcAutoConfiguration backs off its RequestContextFilter
Review Comment:
Remove the comments around dependenices
##########
grails-controllers/src/main/groovy/org/grails/plugins/web/controllers/ControllersAutoConfiguration.java:
##########
@@ -108,13 +108,24 @@ public FilterRegistrationBean<Filter> hiddenHttpMethodFilter() {
return registrationBean;
}
+ // Exposed as a RequestContextFilter bean (GrailsWebRequestFilter extends it) so that Boot's
Review Comment:
Simplify the comment
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#issuecomment-4910612861
## β
All tests passed β
π·οΈ Commit: 5baf4bf287d37f6726a354dd5da14b302deb217b
βΆοΈ Tests: 61684 executed
βͺοΈ Checks: 61/61 completed
---
_Learn more about TestLens at [testlens.app](https://testlens.app)._
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#issuecomment-4773975202
## [Codecov](https://app.codecov.io/gh/apache/grails-core/pull/13863?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 0.0000%. Comparing base ([`02b6cc7`](https://app.codecov.io/gh/apache/grails-core/commit/02b6cc73591170503e80d02ee4fea374c1c2d777?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`04622e3`](https://app.codecov.io/gh/apache/grails-core/commit/04622e3a9cfbd920089329aa6436c6c90f050ca9?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/grails-core/pull/13863?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## 8.0.x #13863 +/- ##
==============================
==============================
```
</details>
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "codeconsole (via GitHub)" <gi...@apache.org>.
codeconsole merged PR #13863:
URL: https://github.com/apache/grails-core/pull/13863
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "codeconsole (via GitHub)" <gi...@apache.org>.
codeconsole commented on code in PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#discussion_r3546849743
##########
grails-controllers/build.gradle:
##########
@@ -63,6 +63,10 @@ dependencies {
testImplementation 'jakarta.servlet:jakarta.servlet-api'
testImplementation 'org.springframework:spring-test'
+ // WebApplicationContextRunner verifies Boot's WebMvcAutoConfiguration backs off its RequestContextFilter
Review Comment:
Removed β dropped the empty configuration closure and its comment on the `spring-test` `compileOnly` dependency.
##########
grails-controllers/src/main/groovy/org/grails/plugins/web/controllers/ControllersAutoConfiguration.java:
##########
@@ -108,13 +108,24 @@ public FilterRegistrationBean<Filter> hiddenHttpMethodFilter() {
return registrationBean;
}
+ // Exposed as a RequestContextFilter bean (GrailsWebRequestFilter extends it) so that Boot's
Review Comment:
Simplified β condensed to the two essential points (`GrailsWebRequestFilter` is a `RequestContextFilter` so Boot backs off, and the registration-bean-name gate so a user overriding only that registration makes this raw filter back off with it).
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "codeconsole (via GitHub)" <gi...@apache.org>.
codeconsole commented on PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#issuecomment-4918653281
Acknowledged on sequencing. Worth noting the approach here registers Grails' MVC beans *ahead of* `WebMvcAutoConfiguration` and lets Boot's `@ConditionalOnMissingBean`-guarded beans defer to them, rather than disabling `WebMvcAutoConfiguration` β so it's designed to coexist with code that relies on it being active, not to break it. Happy to verify this branch against the security project before either merges and order them however you'd like β what sequence do you want?
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Stop @EnableWebMvc from being automatically added to Grails Applications [grails-core]
Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on PR #13863:
URL: https://github.com/apache/grails-core/pull/13863#issuecomment-4905621040
I had Fabled take a look at this PR now that we've merged the security changes. I think the issue identified in the security PR is still a problem. We're now registering beans that we don't want registered because using the MVC annotation effectively prevented spring boot from registering from defaults that Grails relied on being absent. Here are the details:
**Impacts beyond what the PR/docs cover**
This is the important part: activating WebMvcAutoConfiguration brings in more than the two things the PR compensates for. These are behavior changes every Grails 8 app will see:
- OrderedFormContentFilter is now registered (on by default via spring.mvc.formcontent.filter.enabled). PUT/PATCH/DELETE form-encoded bodies become visible as request parameters β previously they weren't. Arguably an improvement, but it's a real behavioral difference for apps with PUT/PATCH endpoints doing their own body parsing, and it's not mentioned in the upgrade notes.
- spring.mvc.* and spring.web.* properties now take effect. Any app that had these set (inertly, copied from Boot docs) will see them suddenly activate on upgrade: spring.web.locale, spring.mvc.format.date, spring.web.resources.*, etc.
- Boot's static-resource handling and welcome-page mapping are now live. Boot's WebMvcAutoConfigurationAdapter registers a /** resource handler (classpath:/static, /public, β¦) alongside Grails' own GrailsWebMvcConfigurer handler, plus WelcomePageHandlerMapping. URLs that previously 404'd through Grails URL-mapping error handling may now be served as static resources or an index page β this can change error-page behavior and even shadow expectations in apps with catch-all URL mappings.
- viewResolver is now Boot's ContentNegotiatingViewResolver for non-GSP apps (GSP apps alias it to gspViewResolver as before). Generally compatible since it delegates, but it's a different resolution pipeline than before.
- mvcConversionService is now Boot's ApplicationConversionService (honoring format properties) instead of Spring's plain one, and message converters get the full Boot customization (context ObjectMapper, etc.) β subtle differences for @RestController-style endpoints and MVC-layer binding.
I'd suggest a short bullet list of these in section 31 of the upgrade notes ("other Boot MVC features that become active"), since the current text says "No action is required for most applications" and only documents the two compensated differences.
**One real edge-case bug candidate**
If a user overrides only the grailsWebRequestFilter registration bean (which the docs explicitly bless), the auto-configured grailsWebRequest plain Filter bean is still created (@ConditionalOnMissingBean(GrailsWebRequestFilter.class) doesn't back off), and since no registration bean references it anymore, Boot's adaptable-beans mechanism will auto-register it on /* at Ordered.LOWEST_PRECEDENCE β running in addition to the user's replacement filter. Previously, overriding the registration bean fully removed the Grails filter. The new spec's override test only asserts bean identity in the context, so it wouldn't catch this. Fix options: gate grailsWebRequest on the registration bean name too, or have the override test assert against the actual servlet filter chain.
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org