Posts

How to Create a REST API With Helidon SE and Java?

Image
Hello everyone, Today, we will show you how to create a simple REST API with Helidon SE 2.5.0 and Java 17 . Quick Overview: Helidon SE is designed to be a microframework that fortifies the reactive programming model. Helidon SE features three core APIs to engender a microservice -- a web server, configuration, and security -- for building microservices-predicated applications.  Helidon's web server is an asynchronous and reactive API that runs on top of Netty. The WebServer interface includes support for configuration, routing, error handling, and building metrics and health endpoints. The Config loads and processes configuration properties(application.properties or application.yaml) in key/value format.  The Security class provides support for authentication, sanction, and audit. Let's begin, Final Project Directory: Maven [pom.xml]: <?xml version = "1.0" encoding = "UTF-8" ?> <project xmlns = "http://maven.apache.org/POM/4.0.0" x

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

How To Resolve 'org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean ....' Using @Qualifier Annotation?

Image
Hello everyone, in this article we will learn how to resolve org.springframework.beans.factory. NoUniqueBeanDefinitionException : No qualifying bean of type 'com.example.demo.components.Human' available: expected single matching bean but found 2: employee,employer using @Qualifier Annotation or using @Primary Annotation. Before going to the example just a quick overview of NoUniqueBeanDefinitionException and @Qualifier Annotation. NoUniqueBeanDefinitionException: The ' org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type available: expected single matching bean but found ' will be thrown when the bean is auto-wired that matches two or more loaded beans in the spring boot application context. As a result, the bean could not be auto-wired.  The ApplicationContext represents the Spring IoC container and is responsible for instantiating, configuring, and assembling the aforementioned beans. @Qualifier  Annotation: The @Qualifier a

Learn Java 8 Stream Intermediate And Terminal Operations with Example

Image
Java is Object Oriented Programming language, being object-oriented is not bad, but it brings a lot of verbosity to the program. Java 8 introduced new libraries and programming styles, for example, functional interfaces, lambda expressions, and streams. These bring functional-style programming to the object-oriented programming capabilities of Java. Java Functional Interface and Lambda Expression help us write smaller and cleaner code by removing much boilerplate code.  Java Stream Intermediate operations and Terminal operations The intermediate operation will transform a stream into another stream, such as a map(MapperFn) or a filter(Predicate). The Terminal operation will produce a result or side-effect, such as count() or forEach(Consumer). All intermediate operations will NOT be executed without a terminal operation at the end. So the pattern will be: stream() .intemediateOperation1() .intemediateOperation2() ....................... .intemediateOperationN() .ter