Specific Columns Selection Here I am going to show you an example how to select only specific columns from a table. So you only need to select few columns from a table instead of selecting all columns. In other words you are going to fetch those columns which are required for your business purpose.

Posted in Spring JDBC

Spring JdbcTemplate – Select Specific Columns From Table

Composite Primary Key Composite primary key is a combination of two or more columns in a table. So instead of a single column to be a primary key, more than one column or field is made to be a primary key to uniquely identify the rows in a given table. Let’s say you have created…

Posted in Spring JPA

Spring Boot Composite Primary Key Example

Cucumber Cucumber is a BDD (behavior driven development) framework for running automated acceptance or integration test cases. Cucumber framework is written in Ruby language, but it is also available in other programming language. Cucumber uses Gherkin parser but the implementation is done using the target language. Cucumber allows the execution of feature documentation written in…

Posted in Cucumber Spring Boot

Spring Boot Cucumber Integration Using Gradle

Introduction Here I am going to show you how to write Junit test for Spring Boot main class. A class having main method in Spring boot application is called main class and the purpose of this class is to deploy the application into embedded Tomcat server without configuring deployment descriptor or generating war file for…

Posted in Junit Spring Boot

How To Write Junit Test For Spring Boot Main Class

Introduction In this example I will show you how to convert entity class to DTO (Data Transfer Object) class and DTO class to entity class using MapStruct. So, MapStruct will map entity class to DTO class or vice versa. This example will test both from RESTful webservices and standalone main class. Spring Boot provides CommandLineRunner…

Posted in Spring Boot Spring JPA

Spring Boot Data JPA Entity DTO Mapping Using MapStruct

Introduction In this example I am going to show you how to use Spring’s MultiValueMap in REST API. This MultiValueMap is similar to the Jersey’s MultivaluedMap. A MultiValueMap<K, V> or MultivaluedMap<K, V> is a map of key-values pairs. Each key can have zero or more values, where K – the type of keys maintained by this map and V – the…

Posted in Spring Boot Spring REST

Spring Boot REST API MultiValueMap Example

Introduction Servlet filters are Java classes that are invoked at pre and post processing of requests. So filters are used to intercept requests from clients before they access requests at backend (server). to manipulate responses from server before they are sent back to the client RequestContextFilter is also a servlet filter that extends OncePerRequestFilter that…

Posted in Spring Boot

Spring Boot Filters Example

Introduction The ability of hasPermission() method in Spring Boot Security applications is to determine the accessibility of a particular user for the application. The permission of an access can be read, write, etc. So, a particular user has defined set of access permission by which a user can perform certain activities in the application. The…

Posted in Spring Boot Spring JPA Spring Security

PreAuthorize HasPermission Security Using Spring Boot Data JPA

Problem Recently while I was working with Spring Security in recent versions of Spring Boot framework (2.6.6/2.6.7), I was getting the following error (Requested bean is currently in creation: Is there an unresolvable circular reference?):

Posted in Spring Boot Spring Security

Error bean securityConfig: unresolvable circular reference

Table of Contents Introduction Where is @PreAuthorize applicable? Prerequisites Project Setup MySQL Table Data Application Config Entity Classes Repository Interfaces Service Class REST Controller Class Security Config Spring Boot Main Class Testing Spring Security – PreAuthorize hasRole Source Code Introduction PreAuthorize hasRole Spring security will determine whether a user can invoke a method or not…

Posted in Spring Boot Spring JPA Spring Security

PreAuthorize HasRole Security Using Spring Boot Data JPA

Table of Contents Introduction Prerequisites Project Setup MySQL Table DataSource Config Entity Class Repository Interface Service Class Spring Web Controller Spring Boot Main Class UI (User Interface) Testing Multi Steps Form Source Code Introduction In this example I am going to show you how to build multisteps form using Spring Boot thymeleaf jquery. Multi steps…

Posted in jQuery Spring Boot

Spring Boot Thymeleaf jQuery MultiSteps Form

Table of Contents Introduction Prerequisites Project Setup MySQL Table Application Properties Entity Class Repository Interface Service Class REST Controller Spring Boot Main Class Testing Hazelcast Caching Java Config for Hazelcast Source Code Introduction In this tutorial I am going to show you an example on caching using hazelcast in Spring Boot REST APIs. The cache…

Posted in Spring Boot Spring REST

Caching Using Hazelcast In Spring Boot REST API