Required feature in Autowiring

@Autowired has an argument called required=boolean value By default it is set to true . we can explicitely make it false if we want. If it is true(default behavior) then dependent bean should be available otherwise it throws exception Example package com.kb.autowiringAnnotation;   import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier;   public class Person {       […]

Share this article on

context:component-scan vs context:annotation-config

context:annotation-config This tag is used to activate the annotations inside the beans which are already registered with the Application context. Basically it is used for Autowiring. Context:component-scan This tag does what context:annotation-config does and in addition to that it also scans the packages and registers the stereotype annotated classes as a spring beans. Detailed example […]

Share this article on
< Previous Next >