Upgrade to Spring Boot 4.0.5 and Spring Framework 7.0.6#15354
Upgrade to Spring Boot 4.0.5 and Spring Framework 7.0.6#15354jamesfredley wants to merge 20 commits intoapache:8.0.xfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR upgrades Grails Core to Spring Boot 4.0.1 and Spring Framework 7.0.2, a major version bump that includes significant breaking changes. The upgrade involves updating package imports for relocated Spring Boot autoconfiguration classes, replacing removed Spring Framework APIs, vendoring deprecated theme support code from Spring Framework, and updating test dependencies across all modules.
Changes:
- Upgrade Spring Boot from 3.5.10 to 4.0.1 and Spring Framework to 7.0.2
- Update all package imports for relocated Spring Boot autoconfiguration modules
- Vendor Spring Framework theme support and Hibernate ORM support classes that were removed in Spring Framework 7.0
- Replace removed Spring APIs with updated alternatives (e.g.,
MappedInterceptor.matches(),DefaultTransactionStatusconstructor) - Update test dependencies from
junit-platform-runnertojunit-platform-suite - Update Testcontainers artifact names to new modular format
Reviewed changes
Copilot reviewed 124 out of 125 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| dependencies.gradle | Updates Spring Boot version from 3.5.10 to 4.0.1 |
| build.gradle | Adds Groovy version overrides to prevent Spring Boot 4.0.1's default Groovy 5.0.3 |
| grails-bom/build.gradle | Overrides Groovy version in BOM properties |
| grails-core/src/main/groovy/org/grails/compiler/injection/ApplicationClassInjector.groovy | Updates excluded autoconfiguration class paths |
| grails-core/src/main/groovy/grails/config/external/ExternalConfigRunListener.groovy | Updates ConfigurableBootstrapContext import path |
| grails-core/src/main/groovy/grails/boot/GrailsApp.groovy | Updates WebServerApplicationContext import path |
| grails-controllers/src/main/groovy/org/grails/plugins/web/controllers/ControllersAutoConfiguration.java | Updates multiple Spring Boot autoconfiguration imports |
| grails-web-common/src/main/groovy/org/grails/web/config/http/GrailsFilters.java | Removes SecurityProperties dependency, adds hardcoded DEFAULT_FILTER_ORDER constant |
| grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/mvc/UrlMappingsHandlerMapping.groovy | Updates MappedInterceptor.matches() method signature |
| grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/mvc/UrlMappingsInfoHandlerAdapter.groovy | Deprecates getLastModified() method (removed from interface) |
| grails-web-url-mappings/src/main/groovy/grails/web/mapping/ResponseRedirector.groovy | Replaces MOVED_TEMPORARILY with FOUND constant |
| grails-testing-support-core/src/main/groovy/org/grails/testing/GrailsApplicationBuilder.groovy | Replaces AnnotationConfigServletWebApplicationContext with GenericWebApplicationContext |
| grails-test-suite-base/src/main/groovy/org/grails/support/MockApplicationContext.java | Adds getBeanProvider(ParameterizedTypeReference) method |
| grails-spring/src/main/java/org/springframework/* | Vendors deprecated Spring Framework theme support classes |
| grails-data-hibernate5/core/src/main/java/org/grails/orm/hibernate/support/hibernate5/* | Vendors Spring ORM Hibernate support classes removed in Spring Framework 7.0 |
| grails-data-hibernate5/core/src/test/groovy/grails/gorm/annotation/transactions/TransactionalTransformSpec.groovy | Updates DefaultTransactionStatus constructor calls with new signature |
| grails-data-hibernate5/boot-plugin/src/main/groovy/org/grails/datastore/gorm/boot/autoconfigure/HibernateGormAutoConfiguration.groovy | Updates DataSourceAutoConfiguration and HibernateJpaAutoConfiguration imports |
| grails-data-mongodb/boot-plugin/src/main/groovy/org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfiguration.groovy | Updates MongoAutoConfiguration and MongoProperties imports |
| Multiple build.gradle files | Updates junit-platform-runner to junit-platform-suite and adds new Spring Boot module dependencies |
| Multiple test files | Updates Testcontainers artifact names and Hibernate validation constraint imports |
| LICENSE, NOTICE | Adds attribution for vendored Spring Framework code |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...ate5/core/src/main/java/org/grails/orm/hibernate/support/hibernate5/HibernateOperations.java
Show resolved
Hide resolved
...ate5/core/src/main/java/org/grails/orm/hibernate/support/hibernate5/HibernateOperations.java
Show resolved
Hide resolved
...ate5/core/src/main/java/org/grails/orm/hibernate/support/hibernate5/HibernateOperations.java
Show resolved
Hide resolved
...ate5/core/src/main/java/org/grails/orm/hibernate/support/hibernate5/HibernateOperations.java
Show resolved
Hide resolved
84c65ee to
c7b6d54
Compare
|
micronaut-projects/micronaut-spring#782 might be a blocker for micronaut on Grails 8, since Spring removed the CLASSIC boot loader and there is not yet a version of micronaut-spring released for Spring Boot 4, but the current functional test do pass. There will likely be some additional effort to ensure the micronaut plugin fully functions. https://github.com/micronaut-projects/micronaut-spring/releases/tag/v6.0.0-M1 - has Spring Boot 4.0.x |
# Conflicts: # dependencies.gradle # grails-data-hibernate5/grails-plugin/src/main/groovy/org/grails/plugin/hibernate/support/GrailsOpenSessionInViewInterceptor.java # grails-data-mongodb/boot-plugin/src/test/groovy/org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfigurationSpec.groovy # grails-data-mongodb/boot-plugin/src/test/groovy/org/grails/datastore/gorm/mongodb/boot/autoconfigure/MongoDbGormAutoConfigureWithGeoSpacialSpec.groovy
Micronaut Spring Compatibility NoteFor full Micronaut integration with Spring Boot 4, we should evaluate upgrading to Micronaut Spring 6.0.0-M1 which includes:
The current Recommendation: Evaluate Micronaut Spring 6.0.0-M1 once Micronaut 5 reaches a stable release, or pin 8.0.x Merge StatusMerged latest
Remaining: |
6de5ea4 to
1dfb455
Compare
The 8.0.x merge reintroduced several items that had been removed or updated for Spring Boot 4 compatibility: - Remove vendored Spring theme files (10 files) already removed by apache#15457 - Remove theme references from GrailsApplicationContext (ThemeSource, onRefresh, getTheme) - Remove LoaderImplementation import and CLASSIC loader convention from GrailsGradlePlugin (removed in Spring Boot 4) - Add missing SessionFactoryUtils vendored import in GrailsOpenSessionInViewInterceptor - Add spring-boot-hibernate dependency for HibernateJpaAutoConfiguration package relocation in test example Assisted-by: Claude Code <Claude@Claude.ai>
1dfb455 to
530013a
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
ThemeSource (org.springframework.ui.context.ThemeSource) was removed in Spring Framework 7.0. GrailsWebApplicationContext imported and implemented this interface, causing grails-web-core compilation failure and cascading all downstream CI jobs. Assisted-by: Claude Code <Claude@Claude.ai>
This comment has been minimized.
This comment has been minimized.
Sort org.springframework imports alphabetically before the grails/org.grails group to satisfy checkstyle ImportOrder rule. Assisted-by: Claude Code <Claude@Claude.ai>
This comment has been minimized.
This comment has been minimized.
- Update ApplicationClassInjectorSpec to expect relocated HibernateJpaAutoConfiguration class - Use forked SessionHolder in MultiDataSourceSessionSpec - Add missing RestoreSystemProperties import in MongoDB specs - Remove Spring Theme/ThemeSource references deleted in Spring 7 - Add spring-boot-jdbc test dependency for DataSourceAutoConfiguration Assisted-by: Claude Code <Claude@Claude.ai>
This comment has been minimized.
This comment has been minimized.
Checkstyle requires explicit imports per AvoidStarImport rule. Assisted-by: Claude Code <Claude@Claude.ai>
This comment has been minimized.
This comment has been minimized.
- Remove unused imports (ObjectProvider, UrlMappings) in UrlMappingsAutoConfiguration to fix checkstyle - Add spring-boot-hibernate test dependency to grails-data-hibernate5 boot-plugin for relocated HibernateJpaAutoConfiguration class - Update spring.data.mongodb.* to spring.mongodb.* in MongoDB boot-plugin test specs (property renamed in Spring Boot 4) - Disable integrationTest for modules using grails-spring-security (app1, app3, exploded, plugins/exploded, mongodb/test-data-service) until plugin is updated for Spring Boot 4 - Disable integrationTest for gsp-sitemesh3 (SiteMesh3 incompatible with Spring Framework 7) - Ignore JSP test in gsp-layout (JSP/theme support removed in Spring Framework 7, see apache#15457) - Disable groovydoc for micronaut-singleton test plugin to avoid Groovy version conflict (4.0.29 vs 4.0.30 from Micronaut platform) Assisted-by: Claude Code <Claude@Claude.ai>
This comment has been minimized.
This comment has been minimized.
Adapt AbstractGrailsMockHttpServletResponse to Spring 7 changes in MockHttpServletResponse and restore the previous reset() behavior.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
matrei
left a comment
There was a problem hiding this comment.
Let's merge this and then see where we are with the 8.0.x branch over at Grails Spring Security.
# Conflicts: # grails-testing-support-core/src/main/groovy/org/grails/testing/GrailsApplicationBuilder.groovy # grails-web-boot/src/test/groovy/grails/boot/EmbeddedContainerWithGrailsSpec.groovy
Spring Boot 4.0 moved BootstrapRegistry, BootstrapRegistryInitializer, and ConfigurableBootstrapContext from org.springframework.boot to org.springframework.boot.bootstrap. Update all references and the spring.factories key to use the new package paths. Assisted-by: Claude Code <Claude@Claude.ai>
This comment has been minimized.
This comment has been minimized.
|
I had to merge this branch to hibernate branch to get proxy working |
…elocations DataSourceAutoConfiguration moved from org.springframework.boot.autoconfigure.jdbc to org.springframework.boot.jdbc.autoconfigure and ReactorAutoConfiguration moved from org.springframework.boot.autoconfigure.reactor to org.springframework.boot.reactor.autoconfigure. Update both the source constant and the test expectations. Assisted-by: Claude Code <Claude@Claude.ai>
✅ All tests passed ✅🏷️ Commit: b0903f7 Learn more about TestLens at testlens.app. |
|
Replaced by #15541 - duplicate just pushed to origin instead of fork |
Summary
This PR upgrades Grails Core to Spring Boot 4.0.5 and Spring Framework 7.0.6, bringing major framework updates and compatibility fixes.
This PR uses Groovy 4.0.x and Hibernate 5.6-jakarta, since work on Groovy 5 and Hibernate 7.2 is progressing on other branches.
This is the minimum amount required for Grails to run on Spring Boot 4 and Hibernate 5.6-jakarta
Includes merge from 8.0.x branch (7.0.x/7.1.x merge-ups, PluginDiscovery system, deprecations, new
grails-testing-support-http-clientmodule,@CompileStatictag lib support,DatabaseCleanupannotation inheritance, functional test migrations)Key Changes
spring.data.mongodb.*tospring.mongodb.*(Spring Boot 4 migration)Detailed Change Inventory
grails-data-hibernate5/core/src/main/java/.../hibernate5/spring.data.mongodb.*tospring.mongodb.*Breaking Changes in Spring Boot 4 / Spring Framework 7
Package Relocations (Spring Boot 4)
Spring Boot 4 restructured its autoconfigure modules. The following classes moved:
DataSourceAutoConfigurationorg.springframework.boot.autoconfigure.jdbcorg.springframework.boot.jdbc.autoconfigureReactorAutoConfigurationorg.springframework.boot.autoconfigure.reactororg.springframework.boot.reactor.autoconfigureHibernateJpaAutoConfigurationorg.springframework.boot.autoconfigure.orm.jpaorg.springframework.boot.hibernate.autoconfigureMongoAutoConfigurationorg.springframework.boot.autoconfigure.mongoorg.springframework.boot.mongodb.autoconfigureAnnotationConfigServletWebServerApplicationContextorg.springframework.boot.web.servlet.contextorg.springframework.boot.web.server.servlet.contextBootstrapRegistryorg.springframework.bootorg.springframework.boot.bootstrapBootstrapRegistryInitializerorg.springframework.bootorg.springframework.boot.bootstrapConfigurableBootstrapContextorg.springframework.bootorg.springframework.boot.bootstrapProperty Renames (Spring Boot 4)
spring.data.mongodb.hostspring.mongodb.hostspring.data.mongodb.portspring.mongodb.portspring.data.mongodb.urispring.mongodb.urispring.data.mongodb.databasespring.mongodb.databaseRemoved APIs
SecurityProperties.DEFAULT_FILTER_ORDER-100inGrailsFiltersAnnotationConfigServletWebApplicationContextGenericWebApplicationContextfor testingDispatcherServlettheme supportMappedInterceptor.matches(String, PathMatcher)matches(HttpServletRequest)HandlerAdapter.getLastModified()LoaderImplementationenumspring.factories Key Changes (Spring Boot 4)
org.springframework.boot.BootstrapRegistryInitializerorg.springframework.boot.bootstrap.BootstrapRegistryInitializerConstructor Changes (Spring Framework 7)
DefaultTransactionStatusnow requires 8 parameters (addedtransactionNameandnested)Workarounds
Files Changed
Core Module Updates
ApplicationClassInjector.groovy- Updated excluded auto-configuration class pathsGrailsApplicationCompilerAutoConfiguration.java- Updated DataSourceAutoConfiguration pathControllersAutoConfiguration.java- Import reorganization for new packagesGrailsFilters.java- Removed SecurityProperties dependency, added DEFAULT_FILTER_ORDER constantGrailsGradlePlugin.groovy- Removed LoaderImplementation referencesGrailsEnvironmentPostProcessor.java- Updated bootstrap API imports for Spring Boot 4 package relocationGrailsBootstrapRegistryInitializer.java- Updated bootstrap API imports for Spring Boot 4 package relocationspring.factories- Updated BootstrapRegistryInitializer key for Spring Boot 4 package relocationGSP / Theme Removal
GspAutoConfiguration.java- Removed theme resolver configurationGrailsApplicationContext.java- Removed ThemeSource field, onRefresh(), getTheme()GrailsWebApplicationContext.java- Removed ThemeSource import and interface (removed in Spring Framework 7)Testing Support
GrailsApplicationBuilder.groovy- Use GenericWebApplicationContext instead of AnnotationConfigServletWebApplicationContext; integrated 8.0.x PluginDiscovery systemMockApplicationContext.java- AddedgetBeanProvider(ParameterizedTypeReference)methodAbstractGrailsTagTests.groovy- Added static constants for removed theme attributesTransactionalTransformSpec.groovy- Updated DefaultTransactionStatus constructor callsDefaultUrlCreatorTests.groovy- Fixed ambiguous method overloading for setCharacterEncodingURL Mappings
UrlMappingsHandlerMapping.groovy- Updated MappedInterceptor.matches() call signatureUrlMappingsInfoHandlerAdapter.groovy- Deprecated getLastModified() methodMongoDB Support
MongoDbGormAutoConfiguration.groovy- Updated MongoAutoConfiguration import pathMongoDbGormAutoConfigurationSpec.groovy- Updated property names for Spring Boot 4MongoDbGormAutoConfigureWithGeoSpacialSpec.groovy- Updated property names for Spring Boot 4StartMongoGrailsIntegrationExtension.groovy- Updated spring.mongodb.uri propertymongodb/base/application.yml- Updated spring.mongodb.host/port propertiesBuild Configuration
grails-data-hibernate5/boot-plugin/build.gradle- Added spring-boot-jdbc and spring-boot-hibernate test dependenciesgrails-test-examples/hibernate5/spring-boot-hibernate/build.gradle- Added spring-boot-hibernate for package relocationTest Status
CI Build Status
All CI test suites pass when Apache repository (repository.apache.org) is reachable:
./gradlew build -PonlyCoreTests)./gradlew build -PonlyFunctionalTests)./gradlew build -PonlyHibernate5Tests)./gradlew build -PonlyMongodbTests)Note: Some CI runs may fail due to transient connectivity issues with repository.apache.org (37.27.138.133). These are infrastructure issues, not test failures.
Known Build Issues (WIP)
ApplicationClassInjectorSpec- test expects old autoconfigure package pathDisabled Tests (External Plugin Incompatibilities)
The following test modules have their
integrationTesttask disabled at the build level, since the Spring Security auto-configuration failure prevents the ApplicationContext from loading (cascading to all tests in the module):app1ReflectionUtils.getApplication()removed in Spring Boot 4app3explodedplugins/explodedmongodb/test-data-servicegsp-sitemesh3Additionally, the following individual tests are disabled:
gsp-layout/GrailsLayoutSpec."jsp demo"issue-views-182/CustomErrorSpecRenderMethodTests.testRenderFile(@PendingFeature)Open Decisions
micronautPlatformVersion=4.9.2pulls Micronaut Spring 5.x (targets Spring Boot 3.x)micronaut-spring-boot-starter:6.0.0-M1for Spring Boot 4 compat, (b) Wait for Micronaut 5 stable releaseRemaining Work
ApplicationClassInjectorSpecfor new autoconfigure package pathsReflectionUtils.getApplication()removalAction Required
The following external plugins/libraries need updates for full Spring Boot 4 compatibility: