Skip to content

Commit d94bf91

Browse files
authored
Update README.md
1 parent 813c97d commit d94bf91

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,19 @@ public class WidgetController {
9898
record Widget(int id, String name){};
9999
}
100100
```
101-
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`
103+
```
104+
<plugin>
105+
<groupId>org.apache.maven.plugins</groupId>
106+
<artifactId>maven-compiler-plugin</artifactId>
107+
<configuration>
108+
<compilerArgs>
109+
<arg>-AuseJavax=true</arg>
110+
</compilerArgs>
111+
</configuration>
112+
</plugin>
113+
```
102114
## Usage
103115
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.
104116

@@ -156,7 +168,7 @@ WebServer.builder()
156168

157169
```java
158170
@Generated("avaje-javalin-generator")
159-
@Component
171+
@Singleton
160172
public class WidgetController$Route implements WebRoutes {
161173

162174
private final WidgetController controller;
@@ -188,7 +200,7 @@ public class WidgetController$Route implements WebRoutes {
188200

189201
### (Helidon SE) The generated WidgetController$Route.java is:
190202
```java
191-
@Generated("io.dinject.helidon-generator")
203+
@Generated("avaje-helidon-generator")
192204
@Singleton
193205
public class WidgetController$Route implements Service {
194206

@@ -221,7 +233,7 @@ public class WidgetController$Route implements Service {
221233

222234
```java
223235
@Generated("avaje-helidon-nima-generator")
224-
@Component
236+
@Singleton
225237
public class WidgetController$Route implements HttpService {
226238

227239
private final WidgetController controller;

0 commit comments

Comments
 (0)