Skip to content

Commit

Permalink
Adoc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
altro3 committed Jan 17, 2024
1 parent 716542f commit dbe8c76
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/main/docs/guide/micronautInsideSpring.adoc
Original file line number Diff line number Diff line change
@@ -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.
12 changes: 7 additions & 5 deletions src/main/docs/guide/micronautInsideSpring/beanPostProcessor.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,25 @@ 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
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
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
----
2 changes: 1 addition & 1 deletion src/main/docs/guide/sharingLibraries.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion src/main/docs/guide/springToMicronaut/micronautClient.adoc
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
2 changes: 1 addition & 1 deletion src/main/docs/guide/springToMicronaut/springBoot.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit dbe8c76

Please sign in to comment.