gpt4 book ai didi

java - Spring中的ref与依赖属性

转载 作者:IT老高 更新时间:2023-10-28 13:51:36 26 4
gpt4 key购买 nike

我对 Spring 中的 ref 和 depends-on 属性感到困惑。我阅读了 spring 文档但我仍然感到困惑。我想知道两者之间的确切区别以及在哪种情况下应该使用哪一个。

最佳答案

来自官方文档:http://docs.spring.io/spring/docs/3.2.x/javadoc-api/org/springframework/context/annotation/DependsOn.html

Beans on which the current bean depends. Any beans specified are guaranteed to be created by the container before this bean. Used infrequently in cases where a bean does not explicitly depend on another through properties or constructor arguments, but rather depends on the side effects of another bean's initialisation.

关于java - Spring中的ref与依赖属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12663491/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com