Springboot中Mybatis属性映射

来源:互联网 发布:基三正太捏脸数据 编辑:程序博客网 时间:2024/05/20 05:03

mybatis默认是属性名和数据库字段名一一对应的,即
数据库表列:user_name
实体类属性:user_name

但是java中一般使用驼峰命名
数据库表列:user_name
实体类属性:userName

在Springboot中,可以通过设置map-underscore-to-camel-case属性为true来开启驼峰功能。
application.yml中:

mybatis:  configuration:    map-underscore-to-camel-case: true

application.properties中:

mybatis.configuration.map-underscore-to-camel-case:=true
原创粉丝点击