depend-on

           depend-on用來表示一個Bean的實例化依靠另外一個Bean先實例化。

     < bean  id = "emailUtils"  class = "com.trinitesolutions.core.utils.EmailUtils"  depends-on = "originZoneRepository"  >
           < property  name =  "jdbcTemplate"  ref = "jdbcTemplate"  />
           < property  name =  "velocityEngine"  ref = "velocityEngine"  />
           < property  name =  "freemarkerConfiguration"  ref = "freemarkerConfiguration"  />
           < property  name =  "originZoneService"  ref = "originZoneService"  />
     </ bean  >

    也可使用@DependsOn註釋

本站公眾號
   歡迎關注本站公眾號,獲取更多信息