MyBatise에서 무시하기 쉬운 설정 - 낙타 봉 변환

1318 단어
1、Configuration 대상을 실례화하고 맵UnderscoreToCamelCase 속성을true로 설정
public class WrapAndChangeConfigureSqlSessionFactory extends SqlSessionFactoryBean {
    @Override
    public void afterPropertiesSet() throws Exception {
        super.afterPropertiesSet();
        SqlSessionFactory sqlSessionFactory = super.getObject();
        Configuration configuration = sqlSessionFactory.getConfiguration();
        configuration.setMapUnderscoreToCamelCase(true);
    }
}
2. 스프링 boot에 있는 프로필 응용 프로그램.properties에 구성 항목을 추가하려면 다음과 같이 하십시오.
1 mybatis.configuration.mapUnderscoreToCamelCase=true
2  
3 mybatis.configuration.map-underscore-to-camel-case=true

참조:https://www.cnblogs.com/zhangdong92/p/6986653.html

좋은 웹페이지 즐겨찾기