Skip to content

Conversation

jdaugherty
Copy link
Contributor

@jdaugherty jdaugherty commented Aug 4, 2025

Fixes #14017

  1. Adds back support by having the user add grails-micronaut as a dependency and micronautPlatformVersion as a gradle property
  2. updates documentation & includes instructions for how to add support
  3. adds a feature to forge to add micronaut support to grails app

@jamesfredley
Copy link
Contributor

@amacleay-cohere @ysb33r @rlconst latest update on Micronaut support for Grails 7

@jdaugherty jdaugherty force-pushed the micronautTests branch 2 times, most recently from 3638832 to b5c8513 Compare August 5, 2025 17:46
@jdaugherty jdaugherty force-pushed the reproducibleGroovyExtension branch from 9bfe90d to 594b6eb Compare August 5, 2025 17:47
@jdaugherty jdaugherty force-pushed the micronautTests branch 2 times, most recently from 5f9bf1a to 3fcdde0 Compare August 5, 2025 18:23
@jdaugherty jdaugherty changed the title WIP: Micronaut Support #14017 - feature - add back Micronaut support to Grails 7 with optional plugin Aug 5, 2025
@jdaugherty jdaugherty force-pushed the micronautTests branch 4 times, most recently from 3891886 to 37dba4e Compare August 5, 2025 18:40
@jdaugherty jdaugherty marked this pull request as ready for review August 5, 2025 18:48
@jdaugherty
Copy link
Contributor Author

@graemerocher or @sdelamo if either of you have any feedback on this change, it would be helpful.

I am not as familiar with the micronaut project dependencies - for example, should the micronaut cache library still be included? I also took the approach that Grails 6 took: the gradle plugin has some logic to make it just "work" for the end user.

The tests are limited in grails-core, but they are passing. My guess is we'll merge this and then make any incremental changes if there's specific feedback.

@jdaugherty jdaugherty changed the title #14017 - feature - add back Micronaut support to Grails 7 with optional plugin feature - #14017 - add back Micronaut support to Grails 7 with optional plugin Aug 5, 2025
@jdaugherty jdaugherty force-pushed the micronautTests branch 2 times, most recently from 065a8e0 to 09e06a3 Compare August 5, 2025 21:24
@jdaugherty jdaugherty force-pushed the micronautTests branch 2 times, most recently from 97ff0ec to 6032ef1 Compare August 6, 2025 20:29
@sdelamo sdelamo linked an issue Aug 7, 2025 that may be closed by this pull request
Base automatically changed from reproducibleGroovyExtension to 7.0.x August 10, 2025 23:56
Copy link
Contributor

@matrei matrei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions and suggestions.

@jdaugherty
Copy link
Contributor Author

jdaugherty commented Sep 1, 2025

The scaffolding failure was caused by the setters() having @Autowired and not being invoked by the micronaut bean initialization process. Switching to field based fixes that issue.

I'm still concerned about the lack of test coverage, other than the functional test apps, but I think users can try this out in the RC2 and we can go from there.

@jamesfredley @matrei the bean wiring will likely have further issues - anywhere we use a setter with @Autowired doesn't appear to work when grails-micronaut is included. Switching to constructor based initialization worked for the one failure, but there are other examples in the code base that don't use constructor initialization. A work around would be to ignore those beans by default in the EnableMicronaut annotation. Some examples of this:

  1. RequestForwarder trait
  2. ResponseRedirector trait
  3. ResponseRenderer trait
  4. TransactionManagerAware interface
  5. HibernateConnectionSourceFactory
  6. MongoDatastore
  7. AggregateTimestampProvider
  8. DefaultConstraintRegistry
  9. AbstractConnectionSourceFactory
  10. EventBusAware
  11. GrailsInterceptorHandlerInterceptorAdapter (explicit call in the grails plugin won't matter)
  12. RestResponder
  13. AbstractVndErrorRenderer
  14. HalJsonRenderer
  15. AbstractLinkingRenderer
  16. DefaultRendererRegistry
  17. ResolvableGroovyTemplateEngine
  18. JsonViewTest
  19. ParamsAwareLocaleChangeInterceptor
  20. DefaultRequestStateLookupStrategy
  21. GrailsWebDataBinder
  22. DefaultDataBindingSourceRegistry
  23. GrailsConventionGroovyPageLocator
  24. GroovyPageViewResolver
  25. TagLibraryInvoker
  26. UrlMappingsHandlerMapping

A lot of these seem related to a change to support multiple message sources (438d2e0)

Do we fix these to say it's supported? Prior versions of grails had a limited number of micronaut beans, so the grails beans weren't a micronaut bean by default. I'm skeptical people were accessing these beans from micronaut, so we may be able to make this change gradually.

@matrei
Copy link
Contributor

matrei commented Sep 1, 2025

It seems moving to constructor injection created another issue?
https://ge.grails.org/s/uvcrhvfabv75a/failures#1

@jdaugherty
Copy link
Contributor Author

It seems moving to constructor injection created another issue?

https://ge.grails.org/s/uvcrhvfabv75a/failures#1

Odd, this didn't fail locally when I ran through all of the tests. Will take a look.

@jdaugherty
Copy link
Contributor Author

@matrei This should be fixed now (https://ge.grails.org/s/6nvk6sdfjpzre)

@jdaugherty
Copy link
Contributor Author

The forge failures are b/c of the asset pipeline depending on the grails-dependencies-web and we have moved the i18n plugin. I'd rather merge this + publish a new asset pipeline + update the version of the asset pipeline than try to add an exclude for that library. @jamesfredley @matrei thoughts?

@jamesfredley
Copy link
Contributor

@jdaugherty Since you need this merged and published to use the new i18n coordinates to then update and release asset-pipeline, I think we can ignore the failures.

@jdaugherty
Copy link
Contributor Author

I'll publish an asset pipeline release once we get sign off on this then. @matrei / @jamesfredley let me know when you think this is ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Grails 7 - Add optional Micronaut Support
4 participants