Seed BeanRegistry adapter over BeanBuilder - #15957
Conversation
Add experimental BeanRegistryAdapter that still uses BeanBuilder while documenting Spring 7 BeanRegistrar path. Assisted-by: Sisyphus:xai/grok-4.5 [gpt-coding]
There was a problem hiding this comment.
Pull request overview
This PR seeds a new adapter SPI in grails-spring to provide a non-breaking seam between the existing BeanBuilder DSL and Spring 7’s evolving registration APIs, while keeping current BeanBuilder-based behavior intact.
Changes:
- Introduces a new
grails.spring.BeanRegistryAdapterSPI plus aBeanBuilder-backed implementation. - Adds a JUnit smoke test validating that the adapter registers beans via the existing BeanBuilder path.
- Updates the guide to document the intended migration strategy and wires
grails-springinto the shared test Gradle config.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| grails-spring/src/main/groovy/grails/spring/BeanRegistryAdapter.java | Adds the new adapter SPI surface for bean definition + registration. |
| grails-spring/src/main/groovy/grails/spring/BeanBuilderBeanRegistryAdapter.java | Provides the initial adapter implementation by delegating to BeanBuilder. |
| grails-spring/src/test/groovy/grails/spring/BeanBuilderBeanRegistryAdapterTest.groovy | Adds smoke coverage to ensure adapter-driven registration works end-to-end. |
| grails-spring/build.gradle | Applies shared test configuration to ensure module-local JUnit Platform discovery/behavior. |
| grails-doc/src/en/guide/upgrading/beanRegistryAdapter.adoc | Documents the new seam and the high-level migration approach. |
| grails-doc/src/en/guide/toc.yml | Adds the new upgrading guide entry to the documentation TOC. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 8.0.x #15957 +/- ##
================================================
+ Coverage 0 51.4958% +51.4958%
- Complexity 0 17785 +17785
================================================
Files 0 2040 +2040
Lines 0 95598 +95598
Branches 0 16591 +16591
================================================
+ Hits 0 49229 +49229
- Misses 0 39058 +39058
- Partials 0 7311 +7311
🚀 New features to boost your workflow:
|
- Rename the new SPI to GrailsBeanRegistryAdapter (impl BeanBuilderGrailsBeanRegistryAdapter) to avoid colliding with Spring's org.springframework.beans.factory.support.BeanRegistryAdapter - Validate the BeanBuilder constructor argument with Assert.notNull - Align @SInCE and the guide wording to 8.0.x and soften the #15824 reference - Add the ASF license header to the new upgrading guide page Assisted-by: Sisyphus:openai/gpt-5.6-terra [gpt-coding]
The upgrading page described a future "BeanRegistrar-backed implementation", but BeanRegistrar is a Spring registration callback (already integrated in Grails 8), not a registry backend. Reword to scope the adapter to the remaining BeanBuilder DSL paths and note a future implementation would use Spring's BeanRegistry registration APIs. Assisted-by: Sisyphus:openai/gpt-5.6-terra [gpt-coding]
Review feedback addressedPushed Copilot review comments (all four resolved):
Additional review-pass fix ( Local verification: |
Assisted-by: opencode:gpt-5.6-sol
Codecov flagged 91.67% patch coverage with the getter as the only uncovered line. Added a test asserting the adapter exposes the exact BeanBuilder instance it was constructed with. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
✅ All tests passed ✅🏷️ Commit: 16c1836 Learn more about TestLens at testlens.app. |
Description
What was found
What changed
grails.spring.GrailsBeanRegistryAdapter(renamed to avoid colliding with Spring'sorg.springframework.beans.factory.support.BeanRegistryAdapter)BeanBuilderGrailsBeanRegistryAdapterdelegates to the existingBeanBuilder; constructor validated withAssert.notNullBeanRegistryregistration APIs (BeanRegistrar itself is a callback already integrated in Grails 8)Review feedback addressed (commits
0a1f09df85,a20c06fc82)Assert.notNull+ testBeanRegistryAdaptername collided with Spring'sGrailsBeanRegistryAdapter/BeanBuilderGrailsBeanRegistryAdapter@since 8.1vs 8.0.x target8.0.x/ "Grails 8.0".adocmissing ASF header + misleading #15824 wordingBeanRegistryOut of scope / follow-up
BeanRegistryprogrammatic rewritedoWithSpringmigration toolingContributor Checklist
Issue and Scope
8.0.x.Code Quality
Licensing and Attribution
ai-generated-starting-pointlabel applied.Documentation
Assisted-by: Sisyphus:openai/gpt-5.6-terra [gpt-coding]