Solving Josephus Problem Using Python

Introduction In this example, I am going to show you how to solve Josephus problem using Python. The Josephus’ Problem can be stated as follows: There was a group of 41 Jewish soldiers surrounded by Roman army, and they didn’t want to get caught. So, they sat down in a circle and came up with an algorithm. Everybody had a…

Van Eck Sequence Using Python

Introduction In this example I am going to generate Van Eck sequence using Python programming language. Van Eck sequence is not used strictly for research purpose and it is actually application based professional activity. Van Eck sequence can be illustrated as follows: You start with a number 0 at the first position. Not necessarily you have to start with a…

Apache POI Insert Line Break In Excel Cell Data

Introduction Here I am going to show you how to insert line break in excel cell data using Apache POI in Java language. There may be requirements where you need to write long text in a cell or in multiple cells of excel file, but the long text is not fit within the view port or screen of the device;…

Spring Boot Data JPA Entity DTO Mapping Using MapStruct

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 interface to run the project…

Spring Boot REST API MultiValueMap Example

MultiValueMap 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 type of mapped values. This…

Spring Boot Filters 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 extends GenericFilterBean which implements servlet…

PreAuthorize HasPermission Security Using Spring Boot Data JPA

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 most useful annotation @PreAuthorize, which…

Changing Context Path Of Web Application In Tomcat Server

Web Application Here I am going to show you how to change context path of web application in Tomcat server. So, basically when web applications are deployed into Tomcat server and meaningful, memorable context paths are assigned for web applications. Even if you do not want to set any context path for an application, the server assigns a context path…

Convert Date From One Format To Another Format In Java

Date Time Formatting In this example I am going to show you how to convert date or date & time both from one format to another format in Java programming language. There are many situations where you need to convert date format in your Java based application from one format to another format. You can use Java version prior to…

Error bean securityConfig: unresolvable circular reference

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?):