Spring from two angles to automate the assembly:
component scans (component scanning): Spring application context automatically find
the bean created.
Automatic assembly (autowiring): Spring automatically satisfy the dependencies between the bean.
@Component comment. This simple
single annotation class will show as a component class, and told the class to be created Spring
bean. Components scanning is not enabled by default, use @ComponentScan annotation, this annotation can start in Spring
with a component scans.
Enter the value of the corresponding attribute @ComponentScan package name, the package can be scanned to determine the
packet type set to String is unsafe, if refactoring code, then the specified base package might mistake occurred.
Thus we can specify that a class or interface packet contained: