我正在尝试使用 autowire="autodetect"..
在 eclipse code suggest 中没有显示自动检测作为选项..但它显示了其他值,如 byname,bytype,constructor..
我的申请中缺少什么?
最佳答案
它没有为您提供autodetect
,因为(根据the documentation),autodetect
不是一个选项。有效选项为 byName
、byType
和 constructor
。
顺便说一句,这种 Autowiring 是非常过时的。注释 @Autowired
和 @Inject
提供了更好的 Autowiring 控制 - see docs .
更新:自 Spring 3.x 起,autodetect
选项已弃用,因此它不再出现在文档中。然而,它应该仍然有效(参见 javadoc ),所以我最初说它不是一个选项是错误的。
关于java - 为什么自动检测选项对我不可用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3550268/