diff --git a/src/main/docs/guide/micronautInsideSpring.adoc b/src/main/docs/guide/micronautInsideSpring.adoc index 4e3d92777..a255f2048 100644 --- a/src/main/docs/guide/micronautInsideSpring.adoc +++ b/src/main/docs/guide/micronautInsideSpring.adoc @@ -1 +1 @@ -It may be desirable to use Micronaut modules or libraries from a Spring or Spring Boot application. For example you may wish to use the https://guides.micronaut.io/latest/micronaut-http-client.html[Micronaut HTTP Client] or https://micronaut-projects.github.io/micronaut-data/latest/guide/[Micronaut Data] within your Spring application. There are several ways you can integrate Micronaut into a Spring application which are described below. +It may be desirable to use Micronaut modules or libraries from a Spring or Spring Boot application. For example, you may wish to use the https://guides.micronaut.io/latest/micronaut-http-client.html[Micronaut HTTP Client] or https://micronaut-projects.github.io/micronaut-data/latest/guide/[Micronaut Data] within your Spring application. There are several ways you can integrate Micronaut into a Spring application which are described below. diff --git a/src/main/docs/guide/micronautInsideSpring/beanPostProcessor.adoc b/src/main/docs/guide/micronautInsideSpring/beanPostProcessor.adoc index a075f9ea0..a3057441b 100644 --- a/src/main/docs/guide/micronautInsideSpring/beanPostProcessor.adoc +++ b/src/main/docs/guide/micronautInsideSpring/beanPostProcessor.adoc @@ -5,11 +5,12 @@ be added to the Spring Application Context. `MicronautBeanProcessor` requires a constructor parameter which represents a list of the types of Micronaut beans which should be added to the Spring Application Context. The processor may be used in any Spring application. As an example, a Grails 3 -application could take advantage of `MicronautBeanProcessor` to add all of the +application could take advantage of `MicronautBeanProcessor` to add all the Micronaut HTTP Client beans to the Spring Application Context with something like the folowing: -```groovy +[source,groovy] +---- // grails-app/conf/spring/resources.groovy import io.micronaut.spring.beans.MicronautBeanProcessor import io.micronaut.http.client.annotation.Client @@ -17,11 +18,12 @@ import io.micronaut.http.client.annotation.Client beans = { httpClientBeanProcessor MicronautBeanProcessor, Client } -``` +---- Multiple types may be specified: -```groovy +[source,groovy] +---- // grails-app/conf/spring/resources.groovy import io.micronaut.spring.beans.MicronautBeanProcessor import io.micronaut.http.client.annotation.Client @@ -30,7 +32,7 @@ import com.sample.Widget beans = { httpClientBeanProcessor MicronautBeanProcessor, [Client, Widget] } -``` +---- In a non-Grails application something similar may be specified using any of Spring's bean definition styles: diff --git a/src/main/docs/guide/micronautInsideSpring/springBootStarter.adoc b/src/main/docs/guide/micronautInsideSpring/springBootStarter.adoc index 841043008..d3d6a17f3 100644 --- a/src/main/docs/guide/micronautInsideSpring/springBootStarter.adoc +++ b/src/main/docs/guide/micronautInsideSpring/springBootStarter.adoc @@ -45,7 +45,7 @@ When the Spring Boot application starts app all beans provided by Micronaut will NOTE: You can control which beans are exposed to Spring by using the ann:spring.boot.starter.EnableMicronaut[] annotation on your `Application` class and specifying a api:spring.boot.starter.MicronautBeanFilter[] to include or exclude beans from Micronaut. -==== Using Micronaut Data +== Using Micronaut Data Micronaut Data can be used by adding the Micronaut Data annotation processor: diff --git a/src/main/docs/guide/micronautInsideSpring/springParentContext.adoc b/src/main/docs/guide/micronautInsideSpring/springParentContext.adoc index 892ceff9f..4beccb8a9 100644 --- a/src/main/docs/guide/micronautInsideSpring/springParentContext.adoc +++ b/src/main/docs/guide/micronautInsideSpring/springParentContext.adoc @@ -11,10 +11,11 @@ The following example shows how to Configure your Spring Boot application with a .Using the Micronaut Parent Context [source,java] ---- -SpringApplicationBuilder builder = new SpringApplicationBuilder(); -MicronautApplicationContext context = new MicronautApplicationContext(); +var builder = new SpringApplicationBuilder(); +var context = new MicronautApplicationContext(); context.start(); -builder.parent(context); -builder.sources(Application); -builder.build().run(); +builder.parent(context) + .sources(Application.class) + .build() + .run(); ---- diff --git a/src/main/docs/guide/sharingLibraries.adoc b/src/main/docs/guide/sharingLibraries.adoc index 9aa95623b..0647ebba0 100644 --- a/src/main/docs/guide/sharingLibraries.adoc +++ b/src/main/docs/guide/sharingLibraries.adoc @@ -25,7 +25,7 @@ class Application {} You can additionally use the same configuration in a Micronaut application by use the same declaration as above assuming you have correctly configured Micronaut for Spring. See the example project that is part of the guide https://guides.micronaut.io/latest/micronaut-spring-boot.html[Run a Spring Boot Application as a Micronaut Application] for how to configure Micronaut for Spring. -Micronaut will import all declared beans at compilation time. The only limitation is that `ImportBeanDefinitionRegistrar` that require runtime interfaces like `BeanClassLoaderAware` will fail to import with a compilation error since import processing happens during compilation with Micronaut. When creating shared components try avoid defining `ImportBeanDefinitionRegistrar` types that depend on one of the following interfaces: +Micronaut will import all declared beans at compilation time. The only limitation is that `ImportBeanDefinitionRegistrar` that require runtime interfaces like `BeanClassLoaderAware` will fail to import with a compilation error since import processing happens during compilation with Micronaut. When creating shared components try to avoid defining `ImportBeanDefinitionRegistrar` types that depend on one of the following interfaces: * `BeanClassLoaderAware` * `BeanFactoryAware` diff --git a/src/main/docs/guide/springToMicronaut/micronautClient.adoc b/src/main/docs/guide/springToMicronaut/micronautClient.adoc index 900015924..4e6c1e97f 100644 --- a/src/main/docs/guide/springToMicronaut/micronautClient.adoc +++ b/src/main/docs/guide/springToMicronaut/micronautClient.adoc @@ -1,6 +1,6 @@ Since annotations values are mapped at compilation time, this also impacts the authoring of Micronaut's compile-time declarative HTTP client. -You can essentially use Spring annotations to a define a compilation-time HTTP client: +You can essentially use Spring annotations to a defined a compilation-time HTTP client: .Spring `@Client` Implementation [source,java] diff --git a/src/main/docs/guide/springToMicronaut/springBoot.adoc b/src/main/docs/guide/springToMicronaut/springBoot.adoc index c3b97d881..5c64595e4 100644 --- a/src/main/docs/guide/springToMicronaut/springBoot.adoc +++ b/src/main/docs/guide/springToMicronaut/springBoot.adoc @@ -45,7 +45,7 @@ The following Spring Boot specific annotations are supported: With support for `@Configuration` and the majority of Spring Boot conditions it is possible to build auto configurations that work with both Spring Boot and Micronaut. -In addition the following Spring Boot Actuator annotations are supported: +In addition, the following Spring Boot Actuator annotations are supported: .Supported Spring Boot Actuator Annotations diff --git a/src/main/docs/guide/springToMicronaut/springLimitations.adoc b/src/main/docs/guide/springToMicronaut/springLimitations.adoc index c4622c85d..685e1dddf 100644 --- a/src/main/docs/guide/springToMicronaut/springLimitations.adoc +++ b/src/main/docs/guide/springToMicronaut/springLimitations.adoc @@ -3,5 +3,5 @@ As mentioned previously only a subset of Spring is implementated, but enough to The following notable features are currently not supported in Micronaut for Spring either and in general if a feature is not documented here consider it unsupported: * *AspectJ* - Spring's AOP implementation is not supported, you can however use https://docs.micronaut.io/latest/guide/index.html#aop[Micronaut AOP] which is compilation time and reflection free. -* *Spring Expression Language (SpEL)* - SpEL expressions are not supported, property placeholders are however. +* *Spring Expression Language (SpEL)* - SpEL expressions are not supported, property placeholders are, however. * *The Servlet API* - Any reference to the Servlet API is not supported