You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,8 +98,12 @@ public class WidgetController {
98
98
record Widget(intid, Stringname){};
99
99
}
100
100
```
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`
103
107
```
104
108
<plugin>
105
109
<groupId>org.apache.maven.plugins</groupId>
@@ -111,10 +115,6 @@ By default the generated classes will use jakarta.inject.Singleton for wiring. T
111
115
</configuration>
112
116
</plugin>
113
117
```
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.
0 commit comments