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

PreAuthorize HasRole Security Using Spring Boot Data JPA

Spring Security Has Role PreAuthorize hasRole Spring security will determine whether a user can invoke a method or not based on his/her role. hasRole() method returns true if the current principal has the specified role. By default if the supplied role does not start with ROLE_ will be added. This can be customized by modifying the defaultRolePrefix on DefaultWebSecurityExpressionHandler. In…

Spring Boot Thymeleaf jQuery MultiSteps Form

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 form is required when users…

Caching Using Hazelcast In Spring Boot REST API

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 or caching mechanism is used…

Connecting To Multiple Oracle Data Sources Using JDBC LDAP URLs

Table of Contents Introduction Why do you want to connect to multiple database Prerequisites Project Setup Application Properties DataSource Configurations DAO Class Source Code Introduction Here I am going to show you how to connect to Oracle data source using JDBC LDAP URL. I am going to create multiple data sources for connecting to multiple Oracle databases using Spring Boot…

Spring RabbitMQ Retry And Error Handling Example

Table of Contents Introduction What Is Dead Letter Queue Prerequisites Project Setup Application Properties Custom Exception Producer or Sender Consumer or Receiver Config Class Spring Boot Main Class Testing RabbitMQ Dead Letter Queue Source Code Introduction In this example I am going to show you how to retry the failed messages in RabbitMQ message broker. So, here I am going…

Integrate Angular into Spring Boot using Gradle

Table of Contents Introduction Prerequisites Angular Project Settings Gradle Properties Spring Boot Project Build App Testing Angular Spring Boot Integration Source Code Introduction In this tutorial I will show you how to integrate Angular into Spring Boot using Gradle build tool. So, let’s say you have two different projects – Angular application and Spring Boot application and you do not…

Spring Boot application.properties Inheritance/Override

Table of Contents Introduction Prerequisites Project Setup Inheritance/Override Testing The Application Source Code Introduction In this example I am going to show you how to inherit values from application.properties into different environments. So, if you have an application.properties file under class path folder src/main/resources and if you have different environment specific application-{env}.properties files, then you csan inherit key/value pairs from application.properties file. Even you can override the inherited key/value…

Spring Boot RabbitMQ RPC Example

Table of Contents Introduction Callback Queue Message Properties Correlation Id Prerequisites Project Setup Application Properties Configuration Server Client Main Class Output – Testing RPC Source Code Introduction In this tutorial, I am going to show you how to create Spring Boot RabbitMQ RPC Example. RPC is an acronym which stands for Remote Procedure Call, in which a function is executed…

Spring Boot RabbitMQ Message Pattern Example

Table of Contents Introduction Topic Exchange Prerequisites Project Setup Application Properties Sender Receiver Configuration Main Class Testing Message Pattern Source Code Introduction In this tutorial I am going to show you how to build Spring Boot RabbitMQ message pattern example with TopicExchange. FanoutExchange is only capable to broadcast messages to all receivers and it has limitations to send messages selectively. The DirectExchange can allow you…