Spring MVC: Difference between context:annotation-config and context:component-scan - Find Nerd
Difference between <context:annotation-config/> vs <context:component-scan/>:
<context:annotation-config/> : <context:annotation-config/> is used to activate all the annotations that are present in java beans and those are already registered using application context file or being registered while component scanning (annotations). The main point is they need to be registered.
<context:component-scan/> : <context:component-scan/> scan packages and classes within given base packages then it find and register beans into ApplicationContext. It does all things that <context:annotation-config/> is supposed to do.
Example:
From the below example you will see the difference between <context:annotation-config/> and <context:component-config/>. Here I'm taking 3 Beans for reference.
Read full article from Spring MVC: Difference between context:annotation-config and context:component-scan - Find Nerd
No comments:
Post a Comment