I have changed the spring boot version to 2.6.6 from 2.3.4.RELEASE because of security vulnerabilities. My application's deployment is failing.
In pom.xml I have changed the version of only springboot.
<spring.boot.version>2.6.6</spring.boot.version>
Error Log:
Unsatisfied dependency expressed through field ''; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '': Unsatisfied dependency expressed through field ''; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '': Unsatisfied dependency expressed through field ''; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '': Unsatisfied dependency expressed through field ''; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '': Unsatisfied dependency expressed through field ''; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name '': Requested bean is currently in creation: Is there an unresolvable circular reference?"
CodePudding user response:
Well the error message states
Requested bean is currently in creation: Is there an unresolvable circular reference?"
Usually spring boot displays the services for which the circularity was detected. I personally had this problem in the past. The dependency injection is not 100% deterministic and some unrelated changes in your project are now ending up in the detection of such an circular dependency. I am guessing that you are using
@Autowired
to inject you dependencies? When using constructor injection such problems are no longer exist Spring @Autowire on Properties vs Constructor
For now you sadly don´t have any other options then to resolve your circular dependency.
If i am wrong here you need to show more of your exception. from what little that we have it is hard to conclude what is going on :)
CodePudding user response:
@GJohannes The code is tightly coupled and in many places, I am using @Autowired. Instead of this can I use spring.main.allow-circular-references=true