简体   繁体   中英

why autodetect option not available for me?

I am trying to use autowire="autodetect"..

In eclipse code suggest does not show me autodetect as the option..But it shows other values like byname,bytype,constructor..

whats missing in my application?

It's not offering you autodetect because (according to the documentation ), autodetect isn't an option. The valid options are byName , byType amd constructor .

Incidentally, this kind of autowiring is seriously old-fashioned. The annotations @Autowired and @Inject offer much better control over autowiring - see docs .

update: The autodetect option was deprecated as of Spring 3.x, and so it no longer appears in the documentation. It should still work, however (see the javadoc ), so I was wrong to originally say that it wasn't an option.

The autodetect option is deprecated.

In the newer versions of Spring Framework 4.1.6 I get the following exception:

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)

which basically means that now autowire can have only four possible values ie [default, no, byName, byType, constructor]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM