我正在尝试使用autowire=“自动检测”..
在eclipse中,代码suggest不会将自动检测显示为option..But,它会显示其他值,如byname、bytype、constructor..
我的应用程序中缺少什么?
发布于 2010-08-24 02:17:04
它没有为你提供autodetect,因为(根据the documentation的说法),autodetect不是一个选项。有效选项为byName、byType和constructor。
顺便说一句,这种自动装配是非常过时的。注释@Autowired和@Inject提供了对自动装配- see docs的更好的控制。
更新: autodetect选项从Spring3.x开始就被弃用了,因此它不再出现在文档中。然而,它应该仍然可以工作(参见javadoc),所以我最初说它不是一个选项是错误的。
发布于 2015-06-02 19:59:51
自动检测选项已弃用。
在较新版本的Spring Framework 4.1.6中,我得到了以下异常:
Caused by: org.xml.sax.SAXParseException; lineNumber: 7; columnNumber: 83; cvc-enumeration-valid: Value 'autodetect' is not facet-valid with respect to enumeration '[default, no, byName, byType, constructor]'. It must be a value from the enumeration.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)这基本上意味着现在自动布线只能有四个可能的值,即default,no,byName,byType,constructor
https://stackoverflow.com/questions/3550268
复制相似问题