'Relying upon circular reference is discouraged and they are prohibited by default in spring boot apolication
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.
Solution 1:[1]
You can try with this. Add it to file application.properties
spring.main.allow-circular-references=true
And try to run. This is not best solution you still need to find better way to fix problem.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Domagoj Ratko |