The autowiring functionality has five modes which can be used to instruct Spring container to use autowiring for dependency injection:
• no: This is default setting. Explicit bean reference should be used for wiring.
• byName: When autowiring byName, the Spring container looks at the properties of the beans on which autowire attribute is set to byName in the XML configuration file. It then tries to match and wire its properties with the beans defined by the same names in the configuration file.
• byType: When autowiring by datatype, the Spring container looks at the properties of the beans on which autowire attribute is set to byType in the XML configuration file. It then tries to match and wire a property if its type matches with exactly one of the beans name in configuration file. If more than one such beans exist, a fatal exception is thrown.
• constructor: This mode is similar to byType, but type applies to constructor arguments. If there is not exactly one bean of the constructor argument type in the container, a fatal error is raised.
• autodetect: Spring first tries to wire using autowire by constructor, if it does not work, Spring tries to autowire by byType.