|
1 | | -# Quarkus MVC example project |
| 1 | +# quarkus-mvc |
2 | 2 |
|
3 | | -A simple MVC project based on [Quarkus](https://quarkus.io), that comes with a UI to send donations and setup payment mandates |
4 | | -via TrueLayer Payments API. |
| 3 | +This project uses Quarkus, the Supersonic Subatomic Java Framework. |
5 | 4 |
|
6 | | - |
| 5 | +If you want to learn more about Quarkus, please visit its website: <https://quarkus.io/>. |
7 | 6 |
|
| 7 | +## Running the application in dev mode |
8 | 8 |
|
9 | | -## Requirements |
| 9 | +You can run your application in dev mode that enables live coding using: |
10 | 10 |
|
11 | | -To run the project it is enough to have Java 11 installed with with `JAVA_HOME` environment variable configured appropriately; |
| 11 | +```shell script |
| 12 | +./gradlew quarkusDev |
| 13 | +``` |
12 | 14 |
|
13 | | -## Configuration |
| 15 | +> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at <http://localhost:8080/q/dev/>. |
14 | 16 |
|
15 | | -This sample project leverages [Quarkus configuration framework](https://quarkus.io/guides/config) to specify the client |
16 | | -credentials and signing options required to initialise the TrueLayer client. |
| 17 | +## Packaging and running the application |
17 | 18 |
|
18 | | -In this sample application the client is configured for TrueLayer Sandbox environment. Make sure that you're |
19 | | -using a proper set of Sandbox credentials or switch to your desired environment in [`TrueLayerClientProvider.java`](./src/main/java/com/truelayer/quarkusmvc/TrueLayerClientProvider.java#L33) class. |
| 19 | +The application can be packaged using: |
20 | 20 |
|
21 | | -The easiest way to setup the project with your credentials is to fill the [application.properties](./src/main/resources/application.properties) file or |
22 | | -set the following environment variables: |
23 | | -- `TL_CLIENT_ID` |
24 | | -- `TL_CLIENT_SECRET` |
25 | | -- `TL_SIGNING_KEY_ID` |
26 | | -- `TL_SIGNING_PRIVATE_KEY_LOCATION` |
27 | | -In addition, make sure to properly configure the redirect URI in the [DonationService.createDonationLink()](./src/main/java/com/truelayer/quarkusmvc/services/DonationService.java#L71) method, so that the value is one of the redirect URIs set as allowed in your Console Application: |
28 | | -```java |
29 | | -return tlClient.hpp().getHostedPaymentPageLink(paymentResponse.getData().getId(), paymentResponse.getData().getResourceToken(), |
30 | | - URI.create("<redirect_url>")); |
| 21 | +```shell script |
| 22 | +./gradlew build |
31 | 23 | ``` |
32 | 24 |
|
33 | | -Make sure to whitelist the `<redirect_url>` value in your TrueLayer console. |
| 25 | +It produces the `quarkus-run.jar` file in the `build/quarkus-app/` directory. |
| 26 | +Be aware that it’s not an _über-jar_ as the dependencies are copied into the `build/quarkus-app/lib/` directory. |
34 | 27 |
|
35 | | -## Running the application |
| 28 | +The application is now runnable using `java -jar build/quarkus-app/quarkus-run.jar`. |
36 | 29 |
|
37 | | -To run the application, simply execute the following gradle task from the root directory of this sample project: |
| 30 | +If you want to build an _über-jar_, execute the following command: |
38 | 31 |
|
39 | | -```shell |
40 | | -./gradlew quarkusDev |
| 32 | +```shell script |
| 33 | +./gradlew build -Dquarkus.package.jar.type=uber-jar |
| 34 | +``` |
| 35 | + |
| 36 | +The application, packaged as an _über-jar_, is now runnable using `java -jar build/*-runner.jar`. |
| 37 | + |
| 38 | +## Creating a native executable |
| 39 | + |
| 40 | +You can create a native executable using: |
| 41 | + |
| 42 | +```shell script |
| 43 | +./gradlew build -Dquarkus.native.enabled=true |
| 44 | +``` |
| 45 | + |
| 46 | +Or, if you don't have GraalVM installed, you can run the native executable build in a container using: |
| 47 | + |
| 48 | +```shell script |
| 49 | +./gradlew build -Dquarkus.native.enabled=true -Dquarkus.native.container-build=true |
41 | 50 | ``` |
42 | 51 |
|
43 | | -Alternatively, you can load the project in your favorite IDE and rely on IDE plugins to boot the application. |
| 52 | +You can then execute your native executable with: `./build/quarkus-mvc-1.0.0-SNAPSHOT-runner` |
| 53 | + |
| 54 | +If you want to learn more about building native executables, please consult <https://quarkus.io/guides/gradle-tooling>. |
| 55 | + |
| 56 | +## Provided Code |
| 57 | + |
| 58 | +### REST |
44 | 59 |
|
45 | | -## Testing the application |
| 60 | +Easily start your REST Web Services |
46 | 61 |
|
47 | | -Browse to http://localhost:8080/donations or http://localhost:8080/subscriptions |
| 62 | +[Related guide section...](https://quarkus.io/guides/getting-started-reactive#reactive-jax-rs-resources) |
0 commit comments