https://github.com/yotsuba1022/film-module
A sample module for leveraging Quarkus and GraalVM
https://github.com/yotsuba1022/film-module
Last synced: about 2 months ago
JSON representation
A sample module for leveraging Quarkus and GraalVM
- Host: GitHub
- URL: https://github.com/yotsuba1022/film-module
- Owner: yotsuba1022
- Created: 2025-01-26T17:05:29.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-01-26T17:24:12.000Z (3 months ago)
- Last Synced: 2025-01-26T18:25:51.339Z (3 months ago)
- Language: Java
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# film-module
This project uses Quarkus, the Supersonic Subatomic Java Framework.
If you want to learn more about Quarkus, please visit its website: .
## How to Create the Project
You can leverage the `START CODING` in the Quarkus official site ([here](https://code.quarkus.io/)):
Make sure what kind of dependencies you need.
## Fetch the Sample Database
For simplicity, please refer to [restsql/mysql-sakila](https://hub.docker.com/r/restsql/mysql-sakila/) on docker hub.
In this repo, the image has already been configured in the docker-compose.yml,
you can directly launch it before running the app.## Install Graal VM
Please visit Graal VM [official site](https://www.graalvm.org/) for installation instructions#### For MAC OS
[Installation on macOS Platforms](https://www.graalvm.org/22.0/docs/getting-started/macos/)Configure the GRAALVM_HOME environment variable in your system:
```
export GRAALVM_HOME=/Library/Java/JavaVirtualMachines/graalvm-community-openjdk-17.0.9+9.1/Contents/Home
export PATH=$PATH:$GRAALVM_HOME/bin
```
Then, verify the installation by running this command:
```commandline
native-image --version
```
You should be able to see information similar to:
```
GraalVM Runtime Environment GraalVM CE 17.0.9+9.1 (build 17.0.9+9-jvmci-23.0-b22)
Substrate VM GraalVM CE 17.0.9+9.1 (build 17.0.9+9, serial gc)
```
Now you can perform the native build.## Running the Application in Dev Mode
You can run your app in dev mode that enables live coding using:
```shell script
./mvnw quarkus:dev
```Under the dev mode, you hot-reload the whole app by pressing "s" in the command line console:
Also, you can access the dev ui in the browser by pressing "d"
in the command line console (hostname/q/dev-ui/extensions) which can provide you with more insights for the app:
For debugging, use the following command:
```shell script
./mvnw compile quarkus:dev -Ddebug
```If you're using IntelliJ, you can configure the debug setting like this:
The default port is: ``5005``
> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at .
## Packaging and Running the Application
The application can be packaged using:
```shell script
./mvnw package
```It produces the `quarkus-run.jar` file in the `target/quarkus-app/` directory.
Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/quarkus-app/lib/` directory.The application is now runnable using `java -jar target/quarkus-app/quarkus-run.jar`.
If you want to build an _über-jar_, execute the following command:
```shell script
./mvnw package -Dquarkus.package.jar.type=uber-jar
```The application, packaged as an _über-jar_, is now runnable using `java -jar target/*-runner.jar`.
## Creating a Native Executable
You can create a native executable using:
```shell script
./mvnw package -Dnative
```Or, if you don't have GraalVM installed, you can run the native executable build in a container using:
```shell script
./mvnw package -Dnative -Dquarkus.native.container-build=true
```You can then execute your native executable with: `./target/film-module-1.0.0-SNAPSHOT-runner`
The starting time is significantly faster than the traditional Java app:
If you want to learn more about building native executables, please consult .
## Related Guides
- JPAStreamer ([guide](https://quarkiverse.github.io/quarkiverse-docs/quarkus-jpastreamer/dev/)): Express your Hibernate queries as standard Java Streams
- SmallRye OpenAPI ([guide](https://quarkus.io/guides/openapi-swaggerui)): Document your REST APIs with OpenAPI - comes with Swagger UI
- REST Jackson ([guide](https://quarkus.io/guides/rest#json-serialisation)): Jackson serialization support for Quarkus REST. This extension is not compatible with the quarkus-resteasy extension, or any of the extensions that depend on it
- Hibernate ORM with Panache ([guide](https://quarkus.io/guides/hibernate-orm-panache)): Simplify your persistence code for Hibernate ORM via the active record or the repository pattern
- JDBC Driver - MySQL ([guide](https://quarkus.io/guides/datasource)): Connect to the MySQL database via JDBC