Skip to content

Demonstrates some of the capabilities of the Spring Boot framework through a small, simple example.

License

Notifications You must be signed in to change notification settings

raonigabriel/spring-qrcode-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lines of Code Maven Build Vulnerabilities Security Rating Maintainability Rating Reliability Rating Libraries Open in Remote - Containers

Spring Boot QrCode Example

Demonstrates some capabilities of the Spring Boot framework through a small, simple example. After reviewing this example, you should have a good understanding of what Spring Boot can do and get a feel for how easy it is to use. #Features:

  1. Spring Boot 2.7.x, supporting fully executable JARs for Linux based operating systems
  2. WebFlux rest controller to generate qrcode images
  3. Produces binary Content-Type (PNG)
  4. HTTP header manipulation (Cache-Control)
  5. Java Exception translation to HTTP status code
  6. Manual cache eviction (HTTP DELETE)
  7. CORS enabled (GET, DELETE)
  8. Reactive processing (for the image creation)
  9. Uses the Fast Java QrCode Generator library by nayuki.
  10. Spring IoC (Service, Autowired)
  11. Backend caching (Spring "simple" memory-based ConcurrentHashMap)
  12. Scheduled tasks. Automatic cache eviction, every 30 minutes.
  13. Logging (sl4j + logback)
  14. Only 2 classes, about 100 lines of code!!!
  15. Small. Final JAR includes everything (it self-contained) and it's about 18 MB

To get the code:

Clone the repository:

$ git clone https://github.com/raonigabriel/spring-qrcode-example.git

If this is your first time using Github, review http://help.github.com to learn the basics.

To run the application:

From the command line with Maven:

$ cd spring-qrcode-example
$ mvn spring-boot:run 

From the command line with Linux:

$ cd spring-qrcode-example/target
$ ./spring-qrcode-example-x.y.z.jar

Using docker:

$ docker run -d --name qrcode-service --rm -p 8080:8080 raonigabriel/spring-qrcode-example

Access the deployed web application http://localhost:8080/qrcode?text=Hello%20World%20From%20Spring

or

In your preferred IDE such as SpringSource Tool Suite (STS) or IDEA:

  • Import spring-qrcode-example as a Maven Project

License

Code on package "com.github.raonigabriel" (my code) is released under the Apache 2.0 license

Code under on "io.nayuki.fastqrcodegen" (nayuki code) is released under the MIT license

Disclaimer

  • This code comes with no warranty. Use it at your own risk.
  • I don't like Apple. Fuck off, fan-boys.
  • I don't like left-winged snowflakes. Fuck off, code-covenant.
  • I will call my branches the old way. Long live master, fuck-off renaming.

About

Demonstrates some of the capabilities of the Spring Boot framework through a small, simple example.

Topics

Resources

License

Stars

Watchers

Forks

Languages