Automatically assemble bean properties
A total of four automatic assembly types (need to add the Autowire attribute in the bean configuration to specify which type to use)
byname-automatically assembles other beans with the same name or ID as the bean's attributes into the corresponding properties of the bean. If there is no bean that matches the name of the property, the property is not assembled. --Actually the bean ID is compared.
bytype-automatically assembles other beans with the same type of bean properties into the corresponding properties of the bean. If there is no bean that matches the type of the property, the property is not assembled. Limitations : If spring finds multiple beans whose type matches the type of the property that needs to be automatically assembled, spring does not guess which one is more appropriate, but throws an exception. However, the following parameters are provided to specify which bean to inject. The primary property of the <bean> element. If the value is true, then the bean will be preferred over other candidate beans. The default is true. If you want to exclude some beans as candidates, you can set their Autowire-candidate property to false. They are all ignored as candidate beans.
constructor-automatically assembles other beans with the same type as the bean's constructor into the corresponding entry parameters of the Bean constructor.
autodetect-first attempts to assemble automatically using constructor, and if it fails, then try to use Bytype for automatic assembly.
Spring Combat 3-Minimize Spring XML configuration