How to control order of bean init-method invocation in Spring?

后端 未结 3 1244
夕颜
夕颜 2021-01-12 01:40

Suppose I have bean, which init-method or constructor should be called after init-method of another bean. Is it possible?

3条回答
  •  终归单人心
    2021-01-12 02:15

    Use depends-on attribute in spring context XML file:

    
      
    
    

    or @DependsOn annotation on bean if you are using annotations.

提交回复
热议问题