Skip to content

Commit 7dd2957

Browse files
committed
Merge branch 'master' of https://github.com/SentryMan/avaje-http
2 parents ac7cc60 + d37a20a commit 7dd2957

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,12 @@ public class WidgetController {
9898
record Widget(int id, String name){};
9999
}
100100
```
101-
## @Singleton
102-
By default the generated classes will use jakarta.inject.Singleton for wiring. To use Javax Inject, use the compiler arg `-AuseJavax=true`
101+
## DI Usage
102+
The annotation processor will generate controller adapters that can register routes to Javalin/Helidon. The natural way to use the generated adapters is to get a DI library to find and wire them. This is what the below examples do and they use [Avaje-Inject](https://avaje.io/inject/) to do this. The AP will automatically detect the presence of avaje-inject and generate the class to use avaje-inject's `@Component` as the DI annotation.
103+
104+
There isn't a hard requirement to use Avaje for dependency injection. In the absence of avaje-inject the generated class will default to use `@jakarta.inject.Singleton`. Any DI library that can find and wire the generated @Singleton beans can be used. You can even use Dagger2 or Guice to wire the controllers if you so desire.
105+
106+
To have the AP generate using `@javax.inject.Singleton`, use the compiler arg `-AuseJavax=true`
103107
```
104108
<plugin>
105109
<groupId>org.apache.maven.plugins</groupId>
@@ -111,10 +115,6 @@ By default the generated classes will use jakarta.inject.Singleton for wiring. T
111115
</configuration>
112116
</plugin>
113117
```
114-
## Usage
115-
The annotation processor will generate controller adapters that can register routes to Javalin/Helidon. The natural way to use the generated adapters is to get a DI library to find and wire them. This is what the below examples do and they use [Avaje-Inject](https://avaje.io/inject/) to do this.
116-
117-
Note that there isn't a requirement to use Avaje for dependency injection. Any DI library that can find and wire the generated @Singleton beans can be used. You can even use Dagger2 or Guice to wire the controllers if you so desire.
118118

119119
### Usage with Javalin
120120

0 commit comments

Comments
 (0)