A dependency search is when the object itself tries to find a dependency, for example:
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("/application-context.xml"); MyBean bean = applicationContext.getBean("myBean")
Here, the class itself initializes the ApplicationContext via XML, and it searches in context for the bean called myBean in ApplicationContext
Enabling dependencies is when a property is automatically bound when istance is initialized. For instance:
in application-context.xml , we have one line that initializes the bean and another to initialize the object, say MyClass :
<bean id="myBean" class="org.mypackage.MyBean"/> <bean id="myClass" class="org.mypackage.MyClass"/>
Then in MyClass you have something like:
@Component public class MyClass{ @AutoWire MyBean myBean;
In this case, you indicated that two of the two beans are initialized. And myClass bean has a property myBean, which is already initialized due to injection
source share