Posts

Showing posts with the label Spring Boot Examples

Quartz with Spring Boot, Quartz JobListener Example - How to keep track the status of the running job?

Image
Hello everyone, today we will show you how to configure Quartz with Spring Boot and how to keep track the status of the running job. Tech stack Spring Boot 2.6.7 Java 17 Quartz Scheduler Quartz JobListener RAMJobStore for persisting quartz job. Maven Quartz is a richly featured, open-source job scheduling library that can be integrated within virtually any Java application - from the smallest stand-alone application to the largest e-commerce system.  Listeners are objects that you create to perform actions based on events occurring within the scheduler. As you can probably guess, TriggerListeners receive events related to triggers, and JobListeners receive events related to jobs. RAMJobStore is the simplest JobStore to use. It keeps all of its data in RAM. Final Project Directory: Maven[pom.xml] <?xml version = "1.0" encoding = "UTF-8" ?> <project xmlns = "http://maven.apache.org/POM/4.0.0" xmlns:xsi = "http://www.w3.org/2001/XMLSchem

Java Record as DTO in Spring Boot Application

Image
Hello everyone, In this article, we will show how we used Java Record as DTO in the Spring Boot application. GitHub repository link is provided at the end of this tutorial. You can download the source code. From Java 14 onwards, the record is a special type of class declaration aimed at reducing the boilerplate code. Technologies used :  Spring Boot 2.6.3 Spring  Data JPA  Java 17  H2 DB Maven 3+  Let's do it, Final Project Directory: Maven[pom.xml]   A Project Object Model or POM is the fundamental unit of work in Maven. It is an XML file that contains information about the project and configuration details utilized by Maven to build the project. It contains default values for most projects. Some of the configurations that can be designated in the POM is the project dependencies, the plugins or goals that can be executed, the build profiles, and so on. Other information such as the project version, description, developers, mailing lists and such can withal be designated. <?xml

Spring Data JDBC, PostgreSQL, CRUD Example

Image
  Hello everyone, In this article, we will learn how to develop a  REST-style web service with Spring Boot, Spring Data JDBC, and PostgreSQL Database. GitHub repository link is provided at the end of this tutorial. You can download the source code. What's new in this example?  From Java 14 onwards,  the record  is a special type of class declaration aimed at reducing the boilerplate code. For more info  click here From Java 10 onwards,  the var  keyword allows local variable type inference, which means the type for the local variable will be inferred by the compiler, so we don't need to declare that. For more info  click here Technologies used :  Spring Boot 2.6.3 Spring  Data JDBC  Java 17  PostgreSQL Maven 3+  These are APIs that Spring backend App will export:   GET all User's        :     /api/v1/users             : get  GET User by ID     :     /api/v1/users/{id}       : get CREATE User        :     /api/v1/users             : post UPDATE User        :     /api/v1/user