Home > Enterprise >  Relying upon circular reference is discouraged and they are prohibited by default in spring boot apo
Relying upon circular reference is discouraged and they are prohibited by default in spring boot apo

Time:04-14

I am getting below error message when I am running my spring boot application.

Description:

The dependencies of some of the beans in the application context form a cycle:

┌─────┐
|  securityConfiguration (field private com.prity.springbootdemo1.service.UserService com.prity.springbootdemo1.config.SecurityConfiguration.userService)
↑     ↓
|  userServiceImpl (field private org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder com.prity.springbootdemo1.service.UserServiceImpl.passwordEncoder)
└─────┘


Action:

Relying upon circular references is discouraged and they are prohibited by default. Update your application to remove the dependency cycle between beans. As a last resort, it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true.

CodePudding user response:

spring.main.allow-circular-references=true

Add above line in your application.properties file and it will run fine.

  • Related