Spring boot reactive and resilience4j circuit breaker example

Vikas Verma
Introduction Resilience4j is a lightweight, easy-to-use fault tolerance library inspired by Netflix Hystrix, but designed for Java 8 and functional programming. Lightweight, because the library only uses Vavr, which does not have any other external library dependencies. Resilience4j provides higher-order functions (decorators) to enhance any functional interface, lambda expression or method reference with a Circuit Breaker, Rate Limiter, Retry or Bulkhead. You can stack more than one decorator on any functional interface, lambda expression or method reference.

Spring+kotlin+mongo+testcontainer

Vikas Verma
Introduction In this project we shall see how to use testcontainer to test the repository created in mongodb As per their document Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container. Prerequisit Docker Create sample project Go to the spring initializer and create project with language as kotlin and dependencies required are webflux & reactive mongo db

Add swagger to the kotlin spring

Vikas Verma
Introduction In this short article we shall see how to configure swagger with spring webflux project. We create a project on spring initializer and then shall configure swagger. Dependencies Create a project on the spring boot initializer page with dependency as ‘webflux’ and language as ‘java’ In order to work swagger with kotlin you need to add the following repositories in you pom.xml file. Since the swagger dependencyis available in another repository you need to add that repository as well in you ‘pom.

Scala Mongo example with akka-http and akka-stream

Vikas Verma
Introduction In this tutorial we shall create and CRUD web application in Scala. We will use MongoDB Scala Driver to communicate to the mongo database. It is officially supported Scala driver for MongoDB. Along with that we shall create a Rest API using akka-http module and akka-streams. Prerequisites Scala version: 2.13.1 Database: Mongo:3.4.23-xenial Other dependencies About the service/project Application should be able to do CRUD operations on the in mongodb document.

Scala Rest API with akka-http

Vikas Verma
Introduction In this tutorial we shall explore how we can use akka-http to create service with scala. Here we create CRUD service with akka actor and try to see how it work. Versions Scala version: 2.13.1 SBT version: 1.3.4 Other dependencies About the service/project We’ll create two actors that communicate with each other to get the user data and user activity data. Data Classes We need two data classes that keeps the user data and user activity data.

Secure spring boot application with keycloak

Vikas Verma
This is the last blog of the series of securing spring boot application with keycloak. It is recommended to go through this first blog and second blog here. In last blog post of this series we saw how we can configure keycloak for our application. Now in this tutorial we will see how we can use keycloak with spring boot. Prerequisite Docker Keycloak Version Spring Boo: 1.5.17.RELEASE Java: 1.

Setup keycloak sercurity for spring boot application

Vikas Verma
Setup Realm and clients in keycloak This blog is the second part of the series of security spring boot application with keycloak. In first part we install setup in keycloak with docker you can see first part here Version: Keycloak: 4.5.0.Final Pre-requisites Keycloak should be installed in the Create realm A realm secures and manages security metadata for a set of users, applications, and registered oauth clients. Users can be created within a specific realm within the Administration console.

Setup Keycloak with Docker

Vikas Verma
Introduction of Keycloak Open Source Identity and Access Management For Modern Applications and Services. It add authentication to applications and secure services with minimum fuss. No need to deal with storing users or authenticating users. It’s all available out of the box. You’ll even get advanced features such as User Federation, Identity Brokering and Social Login. Prerequisites: Docker: Since we are using Docker to install Keycloak; it should be installed on your machine.

Spring Security With JWT and Oauth2 With Spring Boot

Vikas Verma
Introduction In this article we will see example of how to secure a spring boot rest application with Spring Boot2, Spring Security, Oauth2, and JWT token. 1. Source Code Repository The code used in this article is available in this repository GitHub. 2. Dependencies 2.1. Versions Spring Boot: 2.1.3.RELEASE Java: 1.8 3. Entity Class We create two Entity Classes, one is User and another is Role. User entity class contains user details like name, password, roles details, and role entity contains the role details.

JPA EntityListner example with Spring Boot 1.5.1

Vikas Verma
Introduction To audit any transaction table you can use EntityListener Annotation of the JPA. JPA provide the EntityListener annotations that attach a listener class with the entity that you want to audit. What is audit table ? Audit Tables are used to track transactions against a particular table or tables. They allow you to see an ongoing “log” for future use. There may be users and/or applications that have access to insert, update, and delete out of that table.