Skip to content

Sample app used to validate Quarkus + Serverless + Service Binding

Notifications You must be signed in to change notification settings

sbose78/using-spring-data-jpa-quarkus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Requirements

To compile and run this demo you will need:

In addition, you will need either a PostgreSQL database, or Docker to run one.

If you don't have GraalVM installed, you can download it here:

https://github.com/oracle/graal/releases

Installing GraalVM is very similar to installing any other JDK: just unpack it, add it to your path, and point the JAVA_HOME and GRAALVM_HOME environment variables to it.

You should then use this JDK to run the Maven build.

Building the demo

After having set GraalVM as your JVM, launch the Maven build on the checked out sources of this demo:

mvn package

Running the demo

Prepare a PostgreSQL instance

First we will need a PostgreSQL database; you can launch one easily if you have Docker installed:

docker run --ulimit memlock=-1:-1 -it --rm=true --memory-swappiness=0 --name quarkus_test -e POSTGRES_USER=quarkus_test -e POSTGRES_PASSWORD=quarkus_test -e POSTGRES_DB=quarkus_test -p 5432:5432 postgres:11.5

Alternatively you can setup a PostgreSQL instance in any another way.

The connection properties of the Agroal datasource are configured in the standard Quarkus configuration file, which you will find in src/main/resources/application.properties.

Run Quarkus in developer mode

To run the application in interactive mode (developer mode):

mvn compile quarkus:dev

In this mode you can make changes to the code and have the changes immediately applied, by just refreshing your browser.

Hot reload works even when modifying your JPA entities.
Try it! Even the database schema will be updated on the fly.

Run Quarkus in JVM mode

When you're done playing with "dev-mode" you can run it as a standard Java application.

First compile it:

mvn package

Then run it:

java -jar ./target/using-spring-data-jpa-1.0-SNAPSHOT-runner.jar

Have a look at how fast it boots.
Or measure total native memory consumption...

Run Quarkus as a native application

This same demo can be compiled into native code: no modifications required.

This implies that you no longer need to install a JVM on your production environment, as the runtime technology is included in the produced binary, and optimized to run with minimal resource overhead.

Compilation will take a bit longer, so this step is disabled by default; let's build again by enabling the native profile:

mvn package -Dnative

After getting a cup of coffee, you'll be able to run this binary directly:

./target/using-spring-data-jpa-1.0-SNAPSHOT-runner

About

Sample app used to validate Quarkus + Serverless + Service Binding

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published