Spring Bean Autowiring

We know that Spring framework is building on dependency injection and we are injecting dependencies through spring bean configuration file. We provide bean configuration details in the spring bean configuration file and also specify the beans that will be injected in other beans using ref attribute. Without configuring the inner bean, directly if we want to place inner bean to outer bean, that means there is no need to configure inner beans inside the outer bean. Directly we can place inner bean inside the outer bean automatically then that concept is known as bean auto wiring. Autowiring is only supported if the dependencies are in the form of objects only. By default bean auto wiring is disabled in spring framework. To enable autowiring, we have to add autowire attribute to the bean element or bean tag. There are five ways that a spring bean can be autowired.

1. byname

2. byType

3. Constructor

4. AutoDetect

5. None

About the Author

Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.

We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc