这里只是体现这是Spring第一个项目,以HelloWorld作为标注。现实需求是获取 用户列表信息,并打印执行日记案例
这里要提一嘴的是,现在大多数的Spring项目,基本都是这种方式。主要步骤就是:SpringBoot托管设置
1、对类添加@Component相干的注解,好比@Controller,@Service,@Repository
2、设置ComponentScan的basePackage, 好比在xml文件里设置, 或者在设置类中设置@ComponentScan("com.seven.springframework")注解,或者 直接在APP类中 new AnnotationConfigApplicationContext("com.seven.springframework")指定扫描的basePackage.
欢迎光临 IT评测·应用市场-qidao123.com (https://dis.qidao123.com/) | Powered by Discuz! X3.4 |