How to wire Interdependent beans in Spring?

前端 未结 4 2119
既然无缘
既然无缘 2020-12-15 06:40

I want to declare two beans and instantiate them using Spring dependency injection?


 

        
4条回答
  •  余生分开走
    2020-12-15 07:14

    neesh is right, Spring doesn't do this out of the box.

    Interdependent beans hint at a design problem. The "clean" way to do this is to redesign your services in such a way that there are no such odd dependencies, of course provided that you have control over the implementations.

提交回复
热议问题