File tree Expand file tree Collapse file tree 7 files changed +110
-4
lines changed
jooby-jackson/src/main/java/io/jooby/jackson
jooby-metrics/src/main/java/io/jooby/metrics
jooby-pac4j/src/main/java/io/jooby/pac4j
tests/src/test/java/io/jooby/i3551 Expand file tree Collapse file tree 7 files changed +110
-4
lines changed Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ public void install(@NonNull Jooby application) {
143143 // Parsing exception as 400
144144 application .errorCode (JsonParseException .class , StatusCode .BAD_REQUEST );
145145
146- application .onStarted (
146+ application .onStarting (
147147 () -> {
148148 for (Class <? extends Module > type : modules ) {
149149 Module module = application .require (type );
Original file line number Diff line number Diff line change @@ -241,7 +241,7 @@ public void install(@NonNull Jooby application) {
241241
242242 final Set <Reporter > reporters = new HashSet <>();
243243
244- application .onStarted (
244+ application .onStarting (
245245 () -> {
246246 metricClasses .forEach (
247247 (name , clazz ) -> metricRegistry .register (name , application .require (clazz )));
Original file line number Diff line number Diff line change @@ -447,7 +447,7 @@ public void install(@NonNull Jooby application) throws Exception {
447447 allClients .values ().stream ().flatMap (List ::stream ).filter (r -> !r .isResolved ()).toList ();
448448
449449 if (!unresolved .isEmpty ()) {
450- application .onStarted (
450+ application .onStarting (
451451 () -> {
452452 List <Client > clientList = new ArrayList <>(clients .getClients ());
453453 unresolved .stream ()
@@ -567,7 +567,7 @@ public void install(@NonNull Jooby application) throws Exception {
567567 /** Compute default url as next available route. We only select static path patterns. */
568568 if (options .getDefaultUrl () == null ) {
569569 int index = application .getRoutes ().size ();
570- application .onStarted (
570+ application .onStarting (
571571 () -> {
572572 List <Route > routes = application .getRoutes ();
573573 String defaultUrl = application .getContextPath ();
Original file line number Diff line number Diff line change 1+ /*
2+ * Jooby https://jooby.io
3+ * Apache License Version 2.0 https://jooby.io/LICENSE.txt
4+ * Copyright 2014 Edgar Espina
5+ */
6+ package io .jooby .i3551 ;
7+
8+ import com .fasterxml .jackson .databind .module .SimpleModule ;
9+ import io .jooby .Environment ;
10+ import jakarta .inject .Inject ;
11+
12+ public class GuiceService3551 extends SimpleModule {
13+ private Environment env ;
14+
15+ @ Inject
16+ public GuiceService3551 (Environment env ) {
17+ this .env = env ;
18+ }
19+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Jooby https://jooby.io
3+ * Apache License Version 2.0 https://jooby.io/LICENSE.txt
4+ * Copyright 2014 Edgar Espina
5+ */
6+ package io .jooby .i3551 ;
7+
8+ import static org .junit .jupiter .api .Assertions .*;
9+ import static org .junit .jupiter .api .Assertions .assertEquals ;
10+
11+ import io .jooby .ServiceKey ;
12+ import io .jooby .StatusCode ;
13+ import io .jooby .guice .GuiceModule ;
14+ import io .jooby .jackson .JacksonModule ;
15+ import io .jooby .junit .ServerTest ;
16+ import io .jooby .junit .ServerTestRunner ;
17+
18+ public class Issue3551 {
19+ @ ServerTest
20+ public void shouldEnsureDIOnStartCallbacks (ServerTestRunner runner ) {
21+ runner
22+ .define (
23+ app -> {
24+ app .getServices ()
25+ .put (
26+ ServiceKey .key (Service3551 .class , "service" ),
27+ new Service3551 (app .getEnvironment ()));
28+ app .install (new JacksonModule ().module (JacksonModule3551 .class ));
29+
30+ app .install (new GuiceModule ());
31+
32+ app .onStarting (
33+ () -> {
34+ // Ask jooby registry
35+ assertNotNull (app .require (ServiceKey .key (Service3551 .class , "service" )));
36+ // Ask Guice
37+ assertNotNull (app .require (GuiceService3551 .class ));
38+ assertNotNull (app .require (JacksonModule3551 .class ));
39+ });
40+ app .get ("/3551" , ctx -> StatusCode .OK );
41+ })
42+ .ready (
43+ http -> {
44+ http .get (
45+ "/3551" ,
46+ rsp -> {
47+ assertEquals (StatusCode .OK .value (), rsp .code ());
48+ });
49+ });
50+ }
51+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Jooby https://jooby.io
3+ * Apache License Version 2.0 https://jooby.io/LICENSE.txt
4+ * Copyright 2014 Edgar Espina
5+ */
6+ package io .jooby .i3551 ;
7+
8+ import com .fasterxml .jackson .databind .module .SimpleModule ;
9+ import io .jooby .Environment ;
10+ import jakarta .inject .Inject ;
11+
12+ public class JacksonModule3551 extends SimpleModule {
13+ private Environment env ;
14+
15+ @ Inject
16+ public JacksonModule3551 (Environment env ) {
17+ this .env = env ;
18+ }
19+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Jooby https://jooby.io
3+ * Apache License Version 2.0 https://jooby.io/LICENSE.txt
4+ * Copyright 2014 Edgar Espina
5+ */
6+ package io .jooby .i3551 ;
7+
8+ import com .fasterxml .jackson .databind .module .SimpleModule ;
9+ import io .jooby .Environment ;
10+
11+ public class Service3551 extends SimpleModule {
12+ private Environment env ;
13+
14+ public Service3551 (Environment env ) {
15+ this .env = env ;
16+ }
17+ }
You can’t perform that action at this time.
0 commit comments