jamesfredley commented on PR #15541: URL: https://github.com/apache/grails-core/pull/15541#issuecomment-4200066336
## Micronaut + Spring Boot 4 Compatibility - Conflicting Issues Summary There are several intersecting issues making Micronaut support on Spring Boot 4 challenging. This comment consolidates them for discussion. ### 1. CLASSIC Boot Loader Removed Spring Boot 4 removed `LoaderImplementation.CLASSIC`. In Grails 7, the Grails Gradle Plugin automatically configured `bootJar`/`bootWar` to use the CLASSIC loader when `grails-micronaut` was detected - this was required for `java -jar` execution to work correctly with Micronaut-Spring integration. That automatic configuration has been removed from the plugin since the enum value no longer exists. **Status:** Removed from `GrailsGradlePlugin.configureMicronaut()`. Documented in upgrade guide section 6. Needs verification that `java -jar` still works with Boot 4's default loader for Micronaut-enabled apps. ### 2. Micronaut Platform 5.0.0-M1 Requires JDK 21+ The milestone releases that add Spring Boot 4 support have a JDK baseline conflict: - `micronaut-platform:5.0.0-M1` declares `micronaut-core:5.0.0-M20` - `micronaut-core:5.0.0-M20` requires **JVM runtime version 21 or newer** - Grails 8 targets **JDK 17** as its baseline Gradle dependency resolution explicitly rejects the artifact: ``` Could not resolve io.micronaut:micronaut-inject-groovy:5.0.0-M20 Dependency resolution is looking for a library compatible with JVM runtime version 17, but 'io.micronaut:micronaut-inject-groovy:5.0.0-M20' is only compatible with JVM runtime version 21 or newer. ``` The relevant releases: - https://github.com/micronaut-projects/micronaut-platform/releases/tag/v5.0.0-M1 - https://github.com/micronaut-projects/micronaut-spring/releases/tag/v6.0.0-M1 **Status:** Blocked. Cannot update `micronautPlatformVersion` from `4.9.2` to `5.0.0-M1` without either bumping Grails' JDK baseline to 21 or waiting for a Micronaut release that supports Spring Boot 4 on JDK 17. ### 3. Micronaut 4.x Does Not Support Spring Boot 4 The current `micronautPlatformVersion=4.9.2` (Micronaut 4.x line) does not include Spring Boot 4 compatibility. The `micronaut-spring-boot-starter` from Micronaut 4.x was built against Spring Boot 3.x APIs. **Status:** `grails-micronaut` module currently compiles because its dependencies are `compileOnly`/`api` against the platform BOM, but runtime compatibility with Spring Boot 4 is unverified. ### 4. Bootstrap Context Changes Spring Boot 4 moved the bootstrap classes to a new package: - `org.springframework.boot.BootstrapRegistry` → `org.springframework.boot.bootstrap.BootstrapRegistry` - `org.springframework.boot.BootstrapRegistryInitializer` → `org.springframework.boot.bootstrap.BootstrapRegistryInitializer` - `org.springframework.boot.ConfigurableBootstrapContext` → `org.springframework.boot.bootstrap.ConfigurableBootstrapContext` The Micronaut-Spring integration used `BootstrapRegistryInitializer` to bootstrap the Micronaut `ApplicationContext` alongside Spring's. Grails' own `GrailsBootstrapRegistryInitializer` has been updated to the new package, but the Micronaut-Spring side (`micronaut-spring-boot-starter`) would also need to be updated for Spring Boot 4. **Status:** Grails side updated in `spring.factories`. Micronaut side depends on `micronaut-spring:6.0.0-M1` which targets Spring Boot 4, but that release requires JDK 21+ (see issue 2). ### Options 1. **Wait for Micronaut 4.x Spring Boot 4 support** - If the Micronaut team backports Spring Boot 4 compatibility to the 4.x line (JDK 17 compatible), we can update without a JDK baseline change. 2. **Bump Grails JDK baseline to 21** - Allows using `micronaut-platform:5.0.0-M1` directly, but is a significant change that affects all Grails users. 3. **Ship Grails 8 without Micronaut integration** - Keep `grails-micronaut` at `micronautPlatformVersion=4.9.2` and document that Micronaut integration is not yet compatible with Spring Boot 4. Users would need to wait for a follow-up release. 4. **Conditional Micronaut support** - Publish `grails-micronaut` as a separate artifact with a JDK 21 requirement, while keeping the rest of Grails at JDK 17. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
