You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@grails.apache.org by "jdaugherty (via GitHub)" <gi...@apache.org> on 2026/10/01 16:22:57 UTC
[PR] Start every context of a GrailsAppBuilder hierarchy with a GrailsApp [grails-core]
jdaugherty opened a new pull request, #16462:
URL: https://github.com/apache/grails-core/pull/16462
## Description
Bug fix split out of #16456, as discussed in its review.
`GrailsAppBuilder` only swapped in a `GrailsApp` for the builder it was constructed as. Spring Boot's `child()`, `parent()` and `sibling()` still produced plain `SpringApplicationBuilder`s, so a hierarchy lost the Grails startup defaults, and because the plain parent was launched by a `GrailsApp` it ran the plugin lifecycle too: on 8.0.x, `new GrailsAppBuilder(Shared).child(Application).run(args)` fails with `No bean named 'classLoader' available` while creating `groovyPagesTemplateEngine` in the parent.
The builder now owns the hierarchy itself and overrides every Boot fluent method with a covariant `GrailsAppBuilder` return, so every context of a hierarchy is started by a `GrailsApp`. `GrailsApp` records the members of a hierarchy (a package-scoped flag the builder sets) and runs the plugin lifecycle in the one whose sources include the Grails application class, logging at `INFO` when a member leaves it out. A standalone `GrailsApp` keeps running the lifecycle whatever its sources are. The development-mode watch starts only in the context that owns the plugin manager.
Covered by `GrailsAppBuilderSpec`, `GrailsAppContextHierarchySpec`, a hierarchy feature of `DevelopmentModeWatchSpec`, and two example applications: a shared Spring parent with a Grails web child, and a command-line program with a non-web Grails parent and a Spring child. Documented in a short section of "Executing the Application Class".
What stays in #16456 for 8.1: registering `grailsApplication` and `pluginManager` locally in every context and withdrawing them from the parent when the Grails child closes or fails to start, the refusal of a second Grails application in one hierarchy, the run-status line for contexts without a web server, the public `contextHierarchyMember` property, and the full "Building the Application" page.
## Contributor Checklist
### Issue and Scope
- [x] No issue exists; the problem was found while reviewing #16456, and the background is above.
- [x] This PR addresses the **complete scope** of the bug fix agreed in that review.
- [x] This PR contains a **single, focused change**.
- [x] This PR targets the **correct branch**: a bug fix on `8.0.x`, with the feature parts left on `8.1.x`.
### Code Quality
- [x] I have **added or updated tests** that cover the changes introduced in this PR.
- [x] The covering specs and both example applications pass; CI runs the full build.
- [x] My code follows the project's **code style** guidelines (`:grails-core:codeStyle` is clean).
- [x] This PR does **not** include mass reformatting, style-only changes, or large-scale refactoring.
- [x] Not applicable.
### Licensing and Attribution
- [x] All contributed code is provided under the Apache License 2.0, and new source files include the Apache license header.
- [x] I have the necessary rights to submit this contribution and confirm it is my own original work.
- [x] Not applicable.
--
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] Start every context of a GrailsAppBuilder hierarchy with a GrailsApp [grails-core]
Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on PR #16462:
URL: https://github.com/apache/grails-core/pull/16462#issuecomment-5935772430
@matrei this is the 8.0.x half of #16456, split out as you suggested in your review there: `GrailsAppBuilder` owning its hierarchy with covariant overrides (plus `build()` returning `GrailsApp`), the hierarchy-member flag on `GrailsApp` (package-scoped here, as you proposed), the development-watch guard, their specs, both example applications and a short section in "Executing the Application Class". The finding-2 log line is here too, since it belongs with the member check. The loan return, the second-application refusal, the run-status change and the full doc page stay in #16456, which now carries this branch as a merge so it applies cleanly once this is merged up.
Could you review this one first? The specs here assert only what 8.0.x does: the parent holds the child's `grailsApplication` on loan while it runs, with no claim about what happens when the child closes.
--
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] Start every context of a GrailsAppBuilder hierarchy with a GrailsApp [grails-core]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #16462:
URL: https://github.com/apache/grails-core/pull/16462#issuecomment-5936618609
## [Codecov](https://app.codecov.io/gh/apache/grails-core/pull/16462?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `70.27027%` with `33 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 58.9462%. Comparing base ([`626c81d`](https://app.codecov.io/gh/apache/grails-core/commit/626c81dca39b713f8270bc101acaf92d11632b34?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`b4b09c4`](https://app.codecov.io/gh/apache/grails-core/commit/b4b09c4d0d1773d2bc5e80b09aed92142e18f756?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 2 commits behind head on 8.0.x.
| [Files with missing lines](https://app.codecov.io/gh/apache/grails-core/pull/16462?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...rc/main/groovy/grails/boot/GrailsAppBuilder.groovy](https://app.codecov.io/gh/apache/grails-core/pull/16462?src=pr&el=tree&filepath=grails-core%2Fsrc%2Fmain%2Fgroovy%2Fgrails%2Fboot%2FGrailsAppBuilder.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Z3JhaWxzLWNvcmUvc3JjL21haW4vZ3Jvb3Z5L2dyYWlscy9ib290L0dyYWlsc0FwcEJ1aWxkZXIuZ3Jvb3Z5) | 69.8113% | [30 Missing and 2 partials :warning: ](https://app.codecov.io/gh/apache/grails-core/pull/16462?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...-core/src/main/groovy/grails/boot/GrailsApp.groovy](https://app.codecov.io/gh/apache/grails-core/pull/16462?src=pr&el=tree&filepath=grails-core%2Fsrc%2Fmain%2Fgroovy%2Fgrails%2Fboot%2FGrailsApp.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Z3JhaWxzLWNvcmUvc3JjL21haW4vZ3Jvb3Z5L2dyYWlscy9ib290L0dyYWlsc0FwcC5ncm9vdnk=) | 80.0000% | [0 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/grails-core/pull/16462?src=pr&el=tree&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/16462?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 #16462 +/- ##
==================================================
+ Coverage 58.9311% 58.9462% +0.0150%
- Complexity 24441 24502 +61
==================================================
Files 2174 2174
Lines 107366 107476 +110
Branches 19557 19562 +5
==================================================
+ Hits 63272 63353 +81
- Misses 35231 35261 +30
+ Partials 8863 8862 -1
```
| [Files with missing lines](https://app.codecov.io/gh/apache/grails-core/pull/16462?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [...-core/src/main/groovy/grails/boot/GrailsApp.groovy](https://app.codecov.io/gh/apache/grails-core/pull/16462?src=pr&el=tree&filepath=grails-core%2Fsrc%2Fmain%2Fgroovy%2Fgrails%2Fboot%2FGrailsApp.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Z3JhaWxzLWNvcmUvc3JjL21haW4vZ3Jvb3Z5L2dyYWlscy9ib290L0dyYWlsc0FwcC5ncm9vdnk=) | `49.4681% <80.0000%> (+1.6420%)` | :arrow_up: |
| [...rc/main/groovy/grails/boot/GrailsAppBuilder.groovy](https://app.codecov.io/gh/apache/grails-core/pull/16462?src=pr&el=tree&filepath=grails-core%2Fsrc%2Fmain%2Fgroovy%2Fgrails%2Fboot%2FGrailsAppBuilder.groovy&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Z3JhaWxzLWNvcmUvc3JjL21haW4vZ3Jvb3Z5L2dyYWlscy9ib290L0dyYWlsc0FwcEJ1aWxkZXIuZ3Jvb3Z5) | `70.0935% <69.8113%> (+70.0935%)` | :arrow_up: |
... and [8 files with indirect coverage changes](https://app.codecov.io/gh/apache/grails-core/pull/16462/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
</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] Start every context of a GrailsAppBuilder hierarchy with a GrailsApp [grails-core]
Posted by "testlens-app[bot] (via GitHub)" <gi...@apache.org>.
testlens-app[bot] commented on PR #16462:
URL: https://github.com/apache/grails-core/pull/16462#issuecomment-5937590233
## ✅ All tests passed ✅
🏷️ Commit: b4b09c4d0d1773d2bc5e80b09aed92142e18f756
▶️ Tests: 104085 executed
⚪️ Checks: 87/87 completed
---
_Learn more about TestLens at [testlens.app/docs](https://testlens.app/docs/features/pr-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] Start every context of a GrailsAppBuilder hierarchy with a GrailsApp [grails-core]
Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty merged PR #16462:
URL: https://github.com/apache/grails-core/pull/16462
--
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] Start every context of a GrailsAppBuilder hierarchy with a GrailsApp [grails-core]
Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on PR #16462:
URL: https://github.com/apache/grails-core/pull/16462#issuecomment-5960263633
This was split off the other PR that is already reviewed. Going to merge this and we can iterate if we need to.
--
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