在Spring Boot项目中使用tk.
mybatis 时,需要在application.
yml中
配置相关信息。
示例
配置:
mybatis:mapper-locations: classpath:mapper/*.xml # mapper文件路径configuration:map-underscore-to-camel-case: true # 下划线转驼峰# tk.mybatis 配置mapper:mappers:- tk.mybatis.mapper.common.Mapper # 通用Mappernot-empty: true # insert语句不插入null值identity: MYSQL # 主键自增类型
说明:
- `
mybatis.mapper-locations`:mapper
文件路径,可以使用通配符,例如`classpath:mapper//*.xml`。
- `
mybatis.configuration.map-underscore-to-camel-case`:是否开启下划线转驼峰功能。
- `
mybatis.mapper.mappers`:需要使用的通用Mapper接口,可以
配置多个。
- `
mybatis.mapper.not-empty`:insert语句是否插入null值。
- `
mybatis.mapper.identity`:主键自增类型,可选值为`MYSQL`、`
ORACLE`等。
注意:
- 在使用tk.
mybatis 时,需要在mapper接口上加上`@Mapper`注解。
- 在mapper.xml
文件中,需要使用`tk.
mybatis.mapper.common.Mapper`接口中的方法,例如`insertSelective`、`selectByPrimaryKey`等。
今天的文章 yml文件配置oracle数据库配置(oracle yml配置)分享到此就结束了,感谢您的阅读。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/bian-cheng-ri-ji/52700.html