如何学习spring boot https://www.zhihu.com/question/53729800
创建maven项目 https://www.cnblogs.com/tenglongwentian/p/5564359.html
spring boot 之HelloWorld
spring boot 整合mybatis项目报错
1.在application的启动文件类上加@ComponentScan注解,扫描控制器的路径,@mappersan扫描mapper文件的路径,开始的时候是这样写的@ComponentScan(basePackages="com.test.controllerPack1") @MapperScan("com.test.dao")报错
Field testService in com.test.controllerPack1.MybatisTest required a bean of type 'com.test.service.TestService' that could not be found.
Action:
Consider defining a bean of type 'com.test.service.TestService' in your configuration.
将控制器扫描改为com.test.* 正常启动
@SpringBootApplication注解,相当于@componentScan和@EnableAutoConfiguration和@configuration注解,只作用于启动类的统计包以及下级,对上级无效,所以可以去掉conponentScan然后将启动类移到控制器的上层启动。
2.在mapper.xml中写sql语句,项目报错java.lang.NoSuchMethodException: com.test.dao.TestDao.<init>()
以及错误无法找到对应的类里面的方法,将sql语句放在dao文件中项目正常启动@select("select * from user where id=1")
3.修改maven项目的树状结构
4.导入项目上有红叉,但是类文件上没有,检查java Compiler和project facets里的java版本是否一致。记得maven-->update project。
5.springBoot启动报错