Skip to content

Commit 97ff0ec

Browse files
committed
doc: #14017 - document how to integrate Micronaut with Grails
1 parent 904305a commit 97ff0ec

File tree

3 files changed

+73
-16
lines changed

3 files changed

+73
-16
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
////
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
https://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
////
19+
20+
=== Micronaut Integration
21+
22+
Grails supports using the Micronaut framework via the `grails-micronaut` plugin. The `grails-micronaut` plugin uses the https://micronaut-projects.github.io/micronaut-spring/latest/guide/#springBootStarter[Micronaut Spring Boot Starter] so that both the Micronaut Application Context & Grails Application Context exist side by side.
23+
24+
To enable Micronaut in your Grails application, two steps must be completed. First, the `grails-micronaut` plugin needs added to the build file. Second, the property `micronautPlatformVersion` needs set to your desired version. Only Micronaut 4.9.2 or higher is supported for Grails.
25+
26+
Here's an example build file:
27+
28+
[source,groovy]
29+
.build.gradle
30+
----
31+
dependencies {
32+
implementation 'org.apache.grails:grails-micronaut'
33+
}
34+
----
35+
36+
Here's an example `gradle.properties` file:
37+
38+
[source,properties]
39+
.gradle.properties
40+
----
41+
micronautPlatformVersion=4.9.2
42+
----
43+
44+
When the `grails-micronaut` plugin is present, the Grails Gradle plugin will automatically apply the required annotation processors to your project & ensure the specified Micronaut version is used.

grails-doc/src/en/guide/index.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,11 @@ include::conf/applicationClass/applicationLifeCycle.adoc[]
195195

196196
include::conf/environments.adoc[]
197197

198+
[[micronaut]]
199+
=== Micronaut
200+
201+
include::conf/micronaut.adoc[]
202+
198203
[[dataSource]]
199204
=== The DataSource
200205

grails-doc/src/en/guide/upgrading/upgrading60x.adoc

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,9 @@ grailsVersion={version}
7272

7373
==== 4. Unified Bill of Materials
7474

75-
Previously Grails did not have a single Bill of Materials (BOM).
76-
Instead it had a `micronaut-bom` and a `spring-bom`.
77-
With the removal of Micronaut from the Grails, the `micronaut-bom` is no longer needed.
78-
Instead, we can have a single bom that inherits from the `spring-bom`.
75+
Previously Grails did not have a single Bill of Materials (BOM). Instead it had a `micronaut-bom` and a `spring-bom` that existed side by side. As of Grails 7, a `grails-bom` is published that inherits from the `spring-bom` and the `micronaut-bom` is not included by default.
7976

80-
Grails 7 introduces a BOM that includes all the dependencies required for a Grails application.
81-
This BOM is available in the `org.apache.grails:grails-bom` artifact.
82-
The BOM is automatically applied when a Grails Gradle plugin is applied via the Spring Dependency Management plugin.
83-
For projects that do not use a Grails Gradle plugin, you can apply the BOM via a https://docs.gradle.org/current/userguide/java_platform_plugin.html#sec:java_platform_consumption[Gradle Platform]:
77+
Grails 7 introduces a BOM that includes all the dependencies required for a Grails application. This BOM is available in the `org.apache.grails:grails-bom` artifact. The BOM is automatically applied when a Grails Gradle plugin is applied via the Spring Dependency Management plugin. For projects that do not use a Grails Gradle plugin, you can apply the BOM via a https://docs.gradle.org/current/userguide/java_platform_plugin.html#sec:java_platform_consumption[Gradle Platform]:
8478

8579
[source,groovy]
8680
.build.gradle
@@ -256,14 +250,28 @@ jakartaeeMigration {
256250
6. `grails.beans.util.LazyBeanMap` -> `grails.beans.util.LazyMetaPropertyMap`
257251
7. `org.grails.plugins.databinding.DataBindingGrailsPlugin` -> `DataBindingConfiguration`
258252

259-
===== 12.4 Micronaut in Grails is now supported via the Micronaut Spring Boot Starter
260-
- This change was made based on community input: https://github.com/orgs/grails/discussions/13517
261-
- The removal of Micronaut enabled simplification of the Grails codebase and the return of Live Reload via https://github.com/HotswapProjects/HotswapAgent
262-
- The Micronaut Parent Context is no longer in Grails by default.
263-
- The following dependencies are no longer included in Grails or grails-bom: io.micronaut:micronaut-\*, io.micronaut.cache:micronaut-cache-core, io.micronaut.groovy:micronaut-runtime-groovy and io.micronaut.spring:micronaut-spring-*
264-
- Micronaut can be added via the Micronaut Spring Boot Starter: https://micronaut-projects.github.io/micronaut-spring/latest/guide/#springBootStarter.
265-
- Using Micronaut Parent Context: https://micronaut-projects.github.io/micronaut-spring/latest/guide/#springParentContext
266-
- Using a Bean Post Processor: https://micronaut-projects.github.io/micronaut-spring/latest/guide/#beanPostProcessor
253+
===== 12.4 Micronaut in Grails is now supported via the plugin `grails-micronaut`
254+
In Grails 4 to Grails 6, Micronaut was integrated by making Micronaut the parent context of the Grails application. As of Grails 7, Micronaut is set up via the https://micronaut-projects.github.io/micronaut-spring/latest/guide/#springBootStarter[micronaut-spring-starter] using the `grails-micronaut` plugin. Discussion around this change can be found https://github.com/apache/grails-core/discussions/13517[here].
255+
256+
To enable Micronaut in your Grails application, two steps must be completed. First, the `grails-micronaut` plugin needs added to the build file. Second, the property `micronautPlatformVersion` needs set to your desired version. Only Micronaut 4.9.2 or higher is supported for Grails.
257+
258+
Here's an example build file:
259+
260+
[source,groovy]
261+
.build.gradle
262+
----
263+
dependencies {
264+
implementation 'org.apache.grails:grails-micronaut'
265+
}
266+
----
267+
268+
Here's an example `gradle.properties` file:
269+
270+
[source,properties]
271+
.gradle.properties
272+
----
273+
micronautPlatformVersion=4.9.2
274+
----
267275

268276
===== 12.5 hibernate-ehcache
269277

0 commit comments

Comments
 (0)