标签:boot turn code 驼峰 public type spring ssi oct
springboot链接数据库import org.apache.ibatis.session.Configuration;
import org.mybatis.spring.boot.autoconfigure.ConfigurationCustomizer;
import org.springframework.context.annotation.Bean;
/**
* @author liwen406
* @Title: MyBatisconfig
* @Description:
* @date 2019/1/6 / 22:25
*/
@org.springframework.context.annotation.Configuration
public class MyBatisconfig {
//解决MyBatis驼峰命名方法
@Bean
public ConfigurationCustomizer configurationCustomizer(){
return new ConfigurationCustomizer(){
@Override
public void customize(Configuration configuration) {
configuration.setMapUnderscoreToCamelCase(true);
}
};
}
}
xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<setting name="mapUnderscoreToCamelCase" value="true"/>
</settings>
</configuration>
标签:boot turn code 驼峰 public type spring ssi oct
原文地址:https://blog.51cto.com/357712148/2371951