mybatis 配置踩坑
Mybatis 踩坑
url 常见配置
url: jdbc:mysql://localhost:3306/database?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
yml 文件配置
mybatis:
config-location: classpath:mybatis\mybatis-config.xml
mapper-locations: classpath*:mybatis\mapper\*.xml
这里的 classpath* 很重要!!!!! classpath 会出现错误,而阿里学习视频中这样配没问题!!!!
在配置文件中开启驼峰命名规则
mybatis.configuration.map-underscore-to-camel-case=true
在当前 mapper 中引入其他的 mapper 中的语句
引入的时候必须用全名,也就是包含 namespace + id 就可以直接引用了
例如: