Repository navigation
Resolve the DevTools restart loader through the parent chain - #16324
Merged
jamesfredley merged 1 commit intoSep 9, 2026
Merged
jamesfredley merged 1 commit into
jamesfredley merged 1 commit into
Conversation
Under a DevTools restart the thread context class loader is not always the RestartClassLoader itself. A servlet container swaps its web application loader in during context start (Tomcat's TomcatEmbeddedWebappClassLoader), and that loader delegates to the RestartClassLoader as its parent. A check that matched only the loader's own type fell back to the base loader in exactly that window, which is how a Hibernate 5 SessionFactory built while Tomcat was starting ended up with base-loader entity classes (apache#16287). Walk the parent chain instead, and keep a fallback that already sees the restart loader. Hibernate 5 now mirrors Hibernate 7: the connection source is always the DataSource of record, and the application context, when present, supplies the resource resolver and class loader. That removes the duplicated bean-name derivation from the factory, and setApplicationContext no longer replaces a DataSource that setDataSourceConnectionSource configured. Drop the never-released resolve() alias and the guide paragraph describing the internal wiring, and cover the container-loader case in the specs.
13 of 16 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## fix/16287-devtools-gorm-entities #16324 +/- ##
=====================================================================
Coverage ? 54.7332%
Complexity ? 20542
=====================================================================
Files ? 2105
Lines ? 101169
Branches ? 17971
=====================================================================
Hits ? 55373
Misses ? 37773
Partials ? 8023
🚀 New features to boost your workflow:
|
🚨 TestLens detected 1 failed test 🚨Here is what you can do:
Test SummaryCI / Functional Tests (Java 21, indy=true) > :grails-test-examples-scaffolding:integrationTest
🏷️ Commit: 29abfee Test FailuresUserControllerSpec > User list (:grails-test-examples-scaffolding:integrationTest in CI / Functional Tests (Java 21, indy=true))Rerun ControlsSelect tests to mute in this pull request:
Reuse successful test results:
Click the checkbox to trigger a rerun:
Learn more about TestLens at testlens.app/docs. |
jamesfredley
merged commit Sep 9, 2026
1917fef
into
apache:fix/16287-devtools-gorm-entities
77 of 78 checks passed
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.
Follow-up to #16299 addressing review feedback.
Under a DevTools restart the thread context class loader is not always the RestartClassLoader. Tomcat swaps
in TomcatEmbeddedWebappClassLoader during context start, which delegates to the RestartClassLoader as its
parent. A check that matched only the loader's own type fell back to the base loader in that window, which
is how the Hibernate 5 SessionFactory on 8.0.0-M5 ended up with base-loader entity classes (#16287).
Current 8.0.x only avoids it because the datastore is now constructed before Tomcat starts.
class loader. Removes the duplicated bean-name derivation.