1. 程式人生 > >Springboot中Mybatis屬性對映--開啟駝峰命名

Springboot中Mybatis屬性對映--開啟駝峰命名

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

原文地址:https://blog.csdn.net/zhao0416/article/details/78427191