在mybatis配置文件中可以开启驼峰命名,但是有时候我们在ssm中并不会创建mybatis的配置文件,但又要开启驼峰命名,不开启的话很难受,
那怎么开启呢
百度了蛮久的 就是找不到 有些都是springBoot中配置 自己设置了别的但是没有效果 今天看官网发现里面有写
官方:提示 自 1.3.0 版本开始,新增的 configuration 属性能够在没有对应的 MyBatis XML 配置文件的情况下,直接设置 Configuration 实例。
<bean id="sqlSessionFactoryBean" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mapperLocations" value="classpath:mapper/*.xml"></property>
<property name="configuration">
<bean class="org.apache.ibatis.session.Configuration">
<property name="mapUnderscoreToCamelCase" value="true"/>
</bean>
</property>
</bean>