diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 2e89817..147c58e 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -1,4 +1,4 @@ -name: verify +name: 'build test' on: [pull_request, push] @@ -8,19 +8,14 @@ jobs: steps: - name: Checkout... - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up JDK... - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: 11 - - - name: Retrieve mvn repo cache... - uses: actions/cache@v2 - with: - path: ~/.m2/repository - key: maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }} - restore-keys: maven-${{ runner.os }} + distribution: 'temurin' + cache: 'maven' - name: Build and test... - run: mvn verify \ No newline at end of file + run: mvn -ntp clean verify \ No newline at end of file diff --git a/README.md b/README.md index d3c7b3d..7f12b9d 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Here is how to build it: Now you can check the options available in your app: - java -jar target/bootique-undertow-demo-1.0-SNAPSHOT.jar + java -jar target/bootique-undertow-demo-2.0.jar Option Description ------ ----------- @@ -44,7 +44,7 @@ Now you can check the options available in your app: Run Undertow server: - java -jar target/bootique.undertow.demo-1.0-SNAPSHOT.jar + java -jar target/bootique.undertow.demo-2.0.jar Then open [http://localhost:8080/api/](http://localhost:8080/api/) to do GET/POST requests on the server. diff --git a/pom.xml b/pom.xml index ecc2d6e..27ddbc7 100644 --- a/pom.xml +++ b/pom.xml @@ -12,13 +12,13 @@ io.bootique.undertow.demo bootique-undertow-demo - 1.0-SNAPSHOT + 2.0 jar Bootique + Undertow Demo - io.bootique.undertow.demo.Application + io.bootique.undertow.demo.App @@ -26,7 +26,7 @@ io.bootique.bom bootique-bom - 2.0.B1 + 2.0.1 import pom @@ -34,15 +34,9 @@ - - io.bootique - bootique - compile - io.bootique.undertow bootique-undertow - compile io.bootique.logback diff --git a/src/main/java/io/bootique/undertow/demo/ApplicationModule.java b/src/main/java/io/bootique/undertow/demo/App.java similarity index 60% rename from src/main/java/io/bootique/undertow/demo/ApplicationModule.java rename to src/main/java/io/bootique/undertow/demo/App.java index 3478271..9013556 100644 --- a/src/main/java/io/bootique/undertow/demo/ApplicationModule.java +++ b/src/main/java/io/bootique/undertow/demo/App.java @@ -1,14 +1,25 @@ package io.bootique.undertow.demo; +import io.bootique.Bootique; import io.bootique.di.BQModule; import io.bootique.di.Binder; import io.bootique.undertow.handlers.RootHandler; import io.undertow.server.HttpHandler; /** - * @author Ibragimov Ruslan + * Entry point of application. */ -public class ApplicationModule implements BQModule { +public class App implements BQModule { + + public static void main(String[] args) { + Bootique + .app(args) + .autoLoadModules() + .module(App.class) + .exec() + .exit(); + } + @Override public void configure(Binder binder) { diff --git a/src/main/java/io/bootique/undertow/demo/Application.java b/src/main/java/io/bootique/undertow/demo/Application.java deleted file mode 100644 index 94f8cf4..0000000 --- a/src/main/java/io/bootique/undertow/demo/Application.java +++ /dev/null @@ -1,17 +0,0 @@ -package io.bootique.undertow.demo; - -import io.bootique.Bootique; - -/** - * Entry point of application. - */ -public class Application { - public static void main(String[] args) { - Bootique - .app(args) - .args("--server", "--config=classpath:static.yml") - .moduleProvider(new ApplicationModuleProvider()) - .exec() - .exit(); - } -} diff --git a/src/main/java/io/bootique/undertow/demo/ApplicationModuleProvider.java b/src/main/java/io/bootique/undertow/demo/ApplicationModuleProvider.java deleted file mode 100644 index 20597c5..0000000 --- a/src/main/java/io/bootique/undertow/demo/ApplicationModuleProvider.java +++ /dev/null @@ -1,32 +0,0 @@ -package io.bootique.undertow.demo; - -import io.bootique.BQModuleProvider; -import io.bootique.di.BQModule; -import io.bootique.undertow.UndertowModule; -import io.bootique.undertow.UndertowModuleProvider; - -import java.util.Collection; - -import static java.util.Collections.singletonList; - -/** - * Defines Application module, and their dependencies. - * - * @author Ibragimov Ruslan - */ -public class ApplicationModuleProvider implements BQModuleProvider { - @Override - public BQModule module() { - return new ApplicationModule(); - } - - @Override - public Collection> overrides() { - return singletonList(UndertowModule.class); - } - - @Override - public Collection dependencies() { - return singletonList(new UndertowModuleProvider()); - } -} diff --git a/src/test/java/io/bootique/undertow/demo/EchoHandlerIT.java b/src/test/java/io/bootique/undertow/demo/EchoHandlerIT.java index ab09391..9e7dfb9 100644 --- a/src/test/java/io/bootique/undertow/demo/EchoHandlerIT.java +++ b/src/test/java/io/bootique/undertow/demo/EchoHandlerIT.java @@ -18,7 +18,7 @@ public class EchoHandlerIT { public void testRuntime() { testFactory .app("--server", "--config=classpath:static.yml") - .moduleProvider(new ApplicationModuleProvider()) + .module(App.class) .run(); }