DEV Community

Gautam Kumar
Gautam Kumar

Posted on

SpringBoot x QR code - PixelForest x REST

Hahaha yes, spring too can do this ;)

How REST fits in my app
The resource is the QR code image generated from the text.
The HTTP method is GET β€” retrieving a resource (the QR code).
The text parameter controls which QR code is generated.
The server responds with an image directly, instead of JSON.

Image description

You can create the project via Spring Initializr or with the CLI:

spring init --boot-version=3.5.3 --java-version=21
cd PixelForest
Enter fullscreen mode Exit fullscreen mode

Add these dependencies to your project

<dependency>
  <groupId>com.google.zxing</groupId>
  <artifactId>core</artifactId>
  <version>3.5.0</version>
</dependency>
<dependency>
  <groupId>com.google.zxing</groupId>
  <artifactId>javase</artifactId>
  <version>3.5.0</version>
</dependency>
Enter fullscreen mode Exit fullscreen mode

Tools Used
Spring Boot 3.5
Java 21
Maven
Google ZXing (QR code library)

Refer to this link to know more about ZXing Library = ZXing

Refer to this GitHub link for the complete project = PixelForest

Ways to Extend It

Add JWT auth to secure the endpoint πŸ”
Store QR codes in the cloud or database πŸ’Ύ
Build a React/Vue frontend for it 🎨
Make it scanable from mobile apps πŸ“±

Feel Free to create PRs for my project and enhance it

Top comments (5)

Collapse
 
s1mar2m profile image
Simarjeet

Very informative

Collapse
 
ankit_raj2k21ee52_96b2e6c profile image
Ankit raj2k21ee52

Interesting stuff

Collapse
 
shambhav_shandilya_3df03e profile image
Shambhav Shandilya

Hello Ankit, big fan of your work!!

Collapse
 
vansh_sharma_3c1bcdaf0042 profile image
Vansh Sharma

noice

Collapse
 
aastha_upadhyay_4ad35b794 profile image
Aastha Upadhyay

Bookmarking this!