Skip to main content

Posts

Spring boot retry tutorial

Spring Retry API Spring provides spring-retry API for running business logic with retry options and recovery method or operations. In this tutorial we will learn the usage of all these with example. We are using Spring boot application here for our example code.
Maven dependencies To use spring retry we need below dependencies.
spring-retry This API provides many annotations which we can use in a declarative manner to implement the same.
<dependency> <groupId>org.springframework.retry</groupId> <artifactId>spring-retry</artifactId> <version>1.2.5.RELEASE</version> </dependency> spring-boot-starter-aop Spring AOP is also required for retry implementation.
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId> </dependency> Retry implementation To implement retry w…
Recent posts

XML Validation using XSD schema

We are going to validate XML using XSD schema in Java. We will create XML Schema using XSD and then use same schema to create the XML file. Then we will write our code to validate this XML against same schema.
XSD Schema creation Below is our schema where we are defining the Schema for XML elements. In this schema we creating two elements, one for request and another for response. We are publishing this schema using targetNamespace which we will use during XML creation.
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://services.ttj.com/hello-service" targetNamespace="http://services.ttj.com/hello-service" elementFormDefault="qualified"> <xs:element name="sayHelloRequest"> <xs:complexType> <xs:sequence> <xs:element name="userName" type="xs:string"/> </xs:sequence> </xs:compl…

Setting up ReactJS for development and deployment

In this tutorial we will learn how to create a react application.
Softwares required for ReactJS We need to install below softwares for react development.
Visual studio code This software is free and can be downloaded from https://code.visualstudio.com/download.
Once downloaded, extract the zip  and place the binary under "Applications" and allow app access from System Preferences -> Security & privacy.
Node.JS and NPM Node.JS provides a java script enabled environment to run on a web server. It eases our development for UI based applications. NPM is a package manager which installs along with Node.jS and helpful in installing packages and libraries.
Install Node.JS and NPM using brew.
brew install node Check version of Node and NPM using below command.
node -v npm -v Create React application To create react application we will first install the required package and latter will use it to create our ReactJS application.
Install create-react-app package Execute below co…

Soap over JMS with Spring boot, CXF and Active MQ

Soap over JMS comes with several benefits like, asynchronous processing, one time delivery, assured delivery. This paradigm is mainly used internally in an organization (service providers and clients).
In this tutorial we are going to use Spring boot and Apache CXF to develop a Soap service and then use Active MQ to make it work as "Soap Over JMS".
Creating Soap service using Spring boot and Apache CXF It is very easy to develop a Soap service with Spring boot. We will follow contract first approach to develop the service. We will create a XML schema & use jaxb2 plugin to generate necessary schema classes and then implement the service using them. Please refer below post where it explains in detail, how to develop a Soap service using Spring boot and CXF.
https://www.thetechnojournals.com/2020/01/soap-services-with-spring-boot-and.html
Implementing Soap over JMS To implement the Soap over JMS we need to integrate JMS with soap service where our service listens to a reque…

SOAP service development using Spring boot and Apache CXF

In this tutorial we are going to learn how to develop a SOAP web service using Spring boot and Apache CXF. We will follow the contract first approach to develop our service where we will use jaxb2 maven plugin to generate the java classes which we will use for service implementation.
Why contract first With contract first our primary focus stays with the contract of service to be implemented. Also it is useful to match the input/output with business requirement. We can share the contract with other business units/ customers or users, so it helps them to start early without waiting for the complete implementation. Once our contract is ready we can generate the Java classes using jaxb plugin which generates the java objects using the schema for SOAP contract and we need to focus only on service implementation.
SOAP service development (Hello service) This service will have one operation where user can send their name and in response they will get a hello message with the passed name.
H…

Integrated/Kerberos authentication using Spring boot and SPNEGO API

In this tutorial we will learn how to use Spring boot and SPNEGO API to implement the kerberos or integrated authentication. Kerberos is developed by Massachusetts Institute of Technology (MIT) which is used to authenticate between trusted services using KDC tickets. For example email client, HR portal or employee portal in a corporate network where employee doesn't need to provide their user id & password to access these application in the same domain. Once they are logged in to their machine, they can access such services/application with kerberos authentication.
I am using MAC OS X to demonstrate the kerberos authentication. I have used the same machine to configure and run the application backed with kerberos authentication and my KDC database & application reside on the same machine.
Setting up kerberos  First of all we need to setup kerberos where we will configure the database, create user principals, create policies and keytabs. We need to create our application u…

Setting up kerberos in Mac OS X

Kerberos in MAC OS X Kerberos authentication allows the computers in same domain network to authenticate certain services with prompting the user for credentials. MAC OS X comes with Heimdal Kerberos which is an alternate implementation of the kerberos and uses LDAP as identity management database.
Here we are going to learn how to setup a kerberos on MAC OS X which we will configure latter in our application.
Installing Kerberos In MAC we can use Homebrew for installing any software package. Homebrew makes it very easy to install the kerberos by just executing a simple command as given below.
brew install krb5 Once installation is complete, we need to set the below export commands in user's profile which will make the kerberos utility commands and compiler available to execute from anywhere.
Open user's bash profile:
vi ~/.bash_profile Add below lines:
export PATH=/usr/local/opt/krb5/bin:$PATH export PATH=/usr/local/opt/krb5/sbin:$PATH export LDFLAGS="-L/usr/lo…