Skip to content

Commit bc2a7c4

Browse files
committed
Update tests to use inject ApplicationScope from SystemContext
1 parent 00e5e52 commit bc2a7c4

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ get all the WebRoutes and register them with Javalin using.
5555
fun main(args: Array<String>) {
5656

5757
// get all the webRoutes
58-
val webRoutes = SystemContext.getBeans(WebRoutes::class.java)
58+
val webRoutes = ApplicationScope.list(WebRoutes::class.java)
5959

6060
val javalin = Javalin.create()
6161

tests/test-helidon/src/main/java/org/example/Main.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.example;
22

3-
import io.avaje.inject.SystemContext;
3+
import io.avaje.inject.ApplicationScope;
44
import io.helidon.health.HealthSupport;
55
import io.helidon.media.jackson.JacksonSupport;
66
import io.helidon.metrics.MetricsSupport;
@@ -58,7 +58,7 @@ private static Routing createRouting() {
5858
.register(MetricsSupport.create())
5959
.register("/greet", new GreetService());
6060

61-
SystemContext.getBeans(Service.class).forEach(builder::register);
61+
ApplicationScope.list(Service.class).forEach(builder::register);
6262

6363
return builder.build();
6464
}

tests/test-javalin/src/main/java/org/example/myapp/Main.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import io.avaje.http.api.InvalidTypeArgumentException;
55
import io.avaje.http.api.ValidationException;
66
import io.avaje.http.api.WebRoutes;
7-
import io.avaje.inject.SystemContext;
7+
import io.avaje.inject.ApplicationScope;
88
import io.javalin.Javalin;
99
import io.javalin.http.staticfiles.Location;
1010
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
@@ -71,7 +71,7 @@ public static Javalin start(int port) {
7171
});
7272

7373
// All WebRoutes / Controllers ... from DI Context
74-
List<WebRoutes> webRoutes = SystemContext.getBeans(WebRoutes.class);
74+
List<WebRoutes> webRoutes = ApplicationScope.list(WebRoutes.class);
7575
app.routes(() -> webRoutes.forEach(WebRoutes::registerRoutes));
7676

7777
app.start(port);

tests/test-spark/src/main/java/org/example/web/App.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.example.web;
22

33
import io.avaje.http.api.WebRoutes;
4-
import io.avaje.inject.SystemContext;
54
import spark.Spark;
65

76
public class App {
@@ -17,7 +16,7 @@ public static void main(String[] args) {
1716
return "hello";
1817
});
1918

20-
SystemContext.getBeans(WebRoutes.class)
19+
ApplicationScope.list(WebRoutes.class)
2120
.forEach(WebRoutes::registerRoutes);
2221
}
2322
}

0 commit comments

Comments
 (0)