自动配置(项目根目录下的bean)
springboot会自动将一些类注册进spring IoC容器,
包括有项目根目录下的、第三方依赖中的。
@SpringBootApplication
springboot的启动入口是@SpringBootApplication注解标注的类中的main方法。
@Component
@Component是组件注册注解,标记了当前类是一个bean对象。
@ComponentScan
@ComponentScan的作用是从扫描范围内,识别标注了@Component,
及其衍生注解@RestController、@RequestMapping、@Service的类,
注册到Spring IoC容器中。
springboot中,默认的扫描范围是@SpringBootApplication注解的类所在包、及其下级包。