How spring of circular dependency problem solving

First of all, spring is supported circular dependency. But the cycle of dependence is not good.

Recently, I use jenkins automated deployment, testing, playing out of the jar package, there was a circular dependency problem.

Said here about my problem-solving process

 

I follow the prompts to find the first few classes circular dependencies, and then is to find ways to keep their interdependence.

 

There are two methods available online.

1. use lazy loading, and now you can use this annotation @Lazy, also said that the use of @Async

2. Increase the middle layer, which I have not tried

Guess you like

Origin www.cnblogs.com/ixan/p/11817114.html