SpringBoot 踩坑
虽然一直都在用着 springboot ,但是自己亲自去搭建起来一个完整的项目还是没有过的,趁着要写拖了好久的毕设,刚好用下
以下是遇到的一些问题
No active profile set, falling back to default profiles default
解决,就是需要在启动环境中配置一条 Environment Variables 中配置 spring.profiles.active -- testThis application has no explicit mapping for /error, so you are seeing this as a fallback.
,解决,Application启动类的位置不对.要将Application类放在最外侧,即包含所有子包
原因:spring-boot会自动加载启动类所在包下及其子包下的所有组件.数据库带下划线的字段无法取到值
,解决,这个需要在 配置文件中加一条 mybatis 的配置:mybatis.configuration.map-underscore-to-camel-case=true
No MyBatis mapper was found in '[xx.mapper]' package. Please check your configuration.
,解决,在应用入口类:XxxApplication.java中没有加入@MapperScan(basePackages = {""})注解;