File tree Expand file tree Collapse file tree 7 files changed +21
-21
lines changed Expand file tree Collapse file tree 7 files changed +21
-21
lines changed Original file line number Diff line number Diff line change @@ -106,12 +106,12 @@ To force the AP to generate with `@javax.inject.Singleton`(in the case where you
106106
107107### Usage with Javalin
108108
109- The annotation processor will generate controller classes implementing the Javalin ` Plugin ` interface, which we can register using:
109+ The annotation processor will generate controller classes implementing the ` AvajeJavalinPlugin ` interface, which we can register in javalin using:
110110
111111``` java
112- List<Plugin > routes = ... ; // retrieve using a DI framework
112+ List<AvajeJavalinPlugin > routes = ... ; // retrieve using a DI framework
113113
114- Javalin . create(cfg - > routes. forEach(cfg. plugins :: register )). start();
114+ Javalin . create(cfg - > routes. forEach(cfg:: registerPlugin )). start();
115115```
116116
117117### Usage with Helidon SE (4.x)
Original file line number Diff line number Diff line change 2424 <dependency >
2525 <groupId >io.javalin</groupId >
2626 <artifactId >javalin</artifactId >
27- <version >6.0.0-beta.1 </version >
27+ <version >6.0.0</version >
2828 <scope >provided</scope >
2929 <optional >true</optional >
3030 </dependency >
Original file line number Diff line number Diff line change 6666 <dependency >
6767 <groupId >io.javalin</groupId >
6868 <artifactId >javalin</artifactId >
69- <version >5.6.3 </version >
69+ <version >6.0.0 </version >
7070 <scope >test</scope >
7171 </dependency >
7272
7373 <dependency >
7474 <groupId >io.avaje</groupId >
7575 <artifactId >avaje-http-api</artifactId >
76- <version >${project.version} </version >
77- <scope >test</scope >
76+ <version >2.1-RC3</version >
7877 </dependency >
7978
8079 <dependency >
Original file line number Diff line number Diff line change @@ -287,7 +287,7 @@ void get_stream_NotFoundException() {
287287 assertThat (metrics .responseBytes ()).isEqualTo (0 );
288288 assertThat (metrics .totalMicros ()).isGreaterThan (0 );
289289
290- assertThat (httpException .bodyAsString ()).isEqualTo ("Not Found " );
290+ assertThat (httpException .bodyAsString ()).isEqualTo ("Endpoint GET /this-path-does-not-exist not found " );
291291 assertThat (httpException .isPlainText ()).isTrue ();
292292 assertThat (httpException .contentType ())
293293 .isPresent ()
@@ -480,7 +480,7 @@ void get_notFound() {
480480 final HttpResponse <String > hres = request .GET ().asString ();
481481
482482 assertThat (hres .statusCode ()).isEqualTo (404 );
483- assertThat (hres .body ()).contains ("Not Found " );
483+ assertThat (hres .body ()).contains ("not found " );
484484 final HttpClient .Metrics metrics = clientContext .metrics (true );
485485 assertThat (metrics .totalCount ()).isEqualTo (1 );
486486 assertThat (metrics .errorCount ()).isEqualTo (1 );
@@ -814,7 +814,7 @@ void get_bean_404() {
814814 } catch (HttpException e ) {
815815 assertThat (e .statusCode ()).isEqualTo (404 );
816816 assertThat (e .contentType ()).isPresent ().get ().isEqualTo ("text/plain" );
817- assertThat (e .bodyAsString ()).isEqualTo ("Not Found " );
817+ assertThat (e .bodyAsString ()).isEqualTo ("Endpoint GET /does-not-exist not found " );
818818 }
819819 }
820820
Original file line number Diff line number Diff line change @@ -27,12 +27,7 @@ public static Javalin start(int port) {
2727 Javalin .create (
2828 config -> {
2929 config .showJavalinBanner = false ;
30- config .accessManager (
31- (handler , ctx , permittedRoles ) -> {
32- log .debug ("allow access ..." );
33- handler .handle (ctx );
34- });
35- config .plugins .register (bean );
30+ config .registerPlugin (bean );
3631 });
3732
3833 app .exception (
Original file line number Diff line number Diff line change 66
77import java .time .LocalDate ;
88
9+ import io .avaje .http .api .AvajeJavalinPlugin ;
910import io .avaje .http .api .PathSegment ;
1011import io .avaje .http .api .Validator ;
11- import io .javalin .Javalin ;
12- import io .javalin .plugin . Plugin ;
12+ import io .javalin .config . JavalinConfig ;
13+ import io .javalin .router . JavalinDefaultRouting ;
1314
1415//@Singleton
15- public class HelloController$Route implements Plugin {
16+ public class HelloController$Route extends AvajeJavalinPlugin {
1617
1718 private final HelloController controller ;
1819 private final Validator validator ;
@@ -22,8 +23,13 @@ public class HelloController$Route implements Plugin{
2223 this .validator = validator ;
2324 }
2425
26+
2527 @ Override
26- public void apply (Javalin cfg ) {
28+ public void onStart (JavalinConfig cfg ) {
29+ cfg .router .mount (this ::routes );
30+ }
31+
32+ private void routes (JavalinDefaultRouting cfg ) {
2733
2834 cfg .get ("/hello/message" , ctx -> {
2935 ctx .status (200 );
Original file line number Diff line number Diff line change 1818 <jex .version>2.5</jex .version>
1919 <avaje-inject .version>9.10</avaje-inject .version>
2020 <nima .version>4.0.4</nima .version>
21- <javalin .version>6.0.0-beta.4 </javalin .version>
21+ <javalin .version>6.0.0</javalin .version>
2222 </properties >
2323
2424 <modules >
You can’t perform that action at this time.
0 commit comments