Repository navigation
BUGFIX: message bundles silently failing to resolve in development - #16179
Merged
jdaugherty merged 1 commit intoAug 20, 2026
Merged
jdaugherty merged 1 commit into
jdaugherty merged 1 commit into
Conversation
…ated to find out In development, every message bundle contributed by a plugin, and every base name an application configured itself, silently failed to resolve. Spring Boot's messageSource was built with only the default base name, and nothing warned. The produced type of a factory bean has to be answerable from the bean definition, because a property value cannot be. Asked for the type of grailsUrlMappingsHolder without it, Spring builds a constructor-only ProxyFactoryBean - no property values applied, so no targetSource and no proxyInterfaces - whose getObjectType() returns null, and then falls back to creating the factory bean in full. That resolves the target source and the inner UrlMappingsHolderFactoryBean, evaluates every mapping, reaches the constraints machinery and its List<MessageSource> injection, and so creates Spring Boot's message source - all while bean definition registry post processors are still running. Anything created that early misses ConfigurationPropertiesBindingPostProcessor, so MessageSourceProperties is never bound and keeps its constructor defaults. Not just the base names: encoding, cache-duration and fallback-to-system-locale are lost with it. Only the reload branch built the proxy over an inner bean, so deployed applications were unaffected and the whole of development was not. Each factory-bean definition now declares its produced type through FactoryBean.OBJECT_TYPE_ATTRIBUTE, which Spring consults before instantiating anything. Reload mode is also switched off when running generated bean definitions, since AOT code generation drops custom definition attributes and hot-swapping mappings is meaningless in an image. The regression test issues the eager by-type lookup directly against a bare DefaultListableBeanFactory, so it reproduces with no Grails runtime and no ordering luck: it asserts the holder is still found by type, and that nothing was created in order to answer.
✅ All tests passed ✅Test SummaryCI - Groovy Joint Validation Build / Build Grails with Groovy snapshot (shard 1) > :grails-data-mongodb-core:test
🏷️ Commit: 9a47272 Learn more about TestLens at testlens.app/docs. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 8.0.x #16179 +/- ##
==================================================
- Coverage 53.6425% 53.6348% -0.0076%
+ Complexity 19783 19778 -5
==================================================
Files 2086 2086
Lines 99630 99633 +3
Branches 17594 17594
==================================================
- Hits 53444 53438 -6
- Misses 38542 38549 +7
- Partials 7644 7646 +2
🚀 New features to boost your workflow:
|
codeconsole
requested review from
borinquenkid,
jamesfredley,
jdaugherty,
matrei and
sbglasius
August 20, 2026 16:15
sbglasius
approved these changes
Aug 20, 2026
jdaugherty
approved these changes
Aug 20, 2026
codeconsole
added a commit
to codeconsole/grails-core
that referenced
this pull request
Oct 22, 2026
The Grails Gradle plugin starts every JavaExec in development, so the JVM half started differently from the image, which starts in production from the build information packaged into it. It now runs in production, and once more in development, where bundles stopped resolving until apache#16179 and where this run found it. Each run, the image's included, is told which environment to expect through i18n.check.environment and fails in any other, so a run that silently started in the wrong one cannot pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In development, every message bundle contributed by a plugin, and every base name an application configured itself, silently fails to resolve. Spring Boot's
messageSourceis built with only the defaultmessagesbase name, and nothing warns:Deployed applications are unaffected — only reload mode builds the holder as a proxy — so this is
grails run-app, every GradleJavaExec, and every integration run.Cause
A factory bean's produced type has to be answerable from the bean definition, because a property value cannot be. Asked for the type of
grailsUrlMappingsHolder, Spring builds a constructor-onlyProxyFactoryBean— no property values applied, so notargetSourceand noproxyInterfaces— whosegetObjectType()returnsnull. Spring then falls back to creating the factory bean in full.That resolves the target source and the inner
UrlMappingsHolderFactoryBean, evaluates every URL mapping, reaches the constraints machinery and itsList<MessageSource>injection, and so creates Spring Boot's message source — all while bean definition registry post-processors are still running. Anything created that early missesConfigurationPropertiesBindingPostProcessor, soMessageSourcePropertiesis never bound and keeps its constructor defaults.It is not only the base names:
encoding,cache-durationandfallback-to-system-localeare lost with them.Fix
Each factory-bean definition declares what it produces through
FactoryBean.OBJECT_TYPE_ATTRIBUTE, which Spring consults before instantiating anything:By-type autowiring of
UrlMappingsHolderkeeps working — that is why these definitions live in a post-processor rather than theBeanRegistryAPI — and the hot-swap target source is untouched, so reload still works.Reload mode is additionally switched off when running generated bean definitions: AOT code generation drops custom definition attributes, and hot-swapping mappings is meaningless in an image.
Test
The regression test issues the eager by-type lookup directly against a bare
DefaultListableBeanFactory, so it reproduces with no Grails runtime and no ordering luck. It fails without the fix.Notes
setLazyInit(true)cannot help here: the lazy-init gate is bypassed when a by-type scan runs withallowEagerInit, and these definitions were already lazy.UrlMappingscandidate and the application fails to start withrequired a single bean, but 2 were found.