Example of Application to generate QRCode with Spring Boot WebFlux deployed on Heroku with Travis It will help you go through the modernist deployment with some simple usage of Docker and Travis CI.
install the following stuff before you start
- Java SDK (oraclejdk8/openjdk8)
- Maven
- Docker (Optional)
├── Dockerfile
├── LICENSE
├── README.md
├── pom.xml # application dependency and setup
└── src # your source folder
├── main
│ └── java
│ └── ...
│ └── resources
│ └── application.yml # Configuration for the application
└── test
└── java
└── ...
After launch the start command you can see the home page of QRCode application
1. Build jar (maven)
$ mvn clean install
2. Run jar locally
$ java -jar target/*.jar
3. Open browser and access localhost:8080
http://localhost:8080
4. You shall see the home page of QrCode Application
# This command will build the application
$ docker build . image_name
# and run it locally on port ${PORT}
Ex.> docker run -e "PORT=8080" -p 8080:8080 image_name
# Access localhost:${PORT}
http://localhost:${PORT}
The application expose a REST Service on path http://{ADDRESS}/qrcode
At the moment, the inputs available are:
- text : Message to encode to QRCode image
- other: todo....
Example: http://localhost:8080/qrcode?text=WhatEverYouWant
In the application.yml, you can customize the default parameters:
qrcode:
logo:
enabled: true # Enable the logo in the center of QRCode
path: "classpath:/logo.jpg" # Absolute path, url or classpath of the logo image to embedded
size: 50 # Size of logo in pixel
transparency: 1.0f # Trasparency of logo between 0 and 1
margin: 1 # Internal margin of the QrCode Image
size: 300 # Size of QRCode
rgbColorBackground: "#FFFFFF" # Background color of QrCode
rgbColorForeground: "#000000" # Foreground color of QrCode