Я использую отдельный xml-файл для настройки параметров mybatis, как показано ниже:
<?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>
<!-- changes from the defaults -->
<setting name="lazyLoadingEnabled" value="false" />
<!-- Mybatis logging -->
<!-- <setting name="logImpl" value="LOG4J2"/> -->
</settings>
<typeAliases>
<package name="com.mydomain.package"/>
</typeAliases>
<environments default="development">
<environment id="development">
<transactionManager type="JDBC"/>
<dataSource type="POOLED">
<property name="driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
<property name="url" value="jdbc:sqlserver://127.0.0.1:1433;DatabaseName=test"/>
<property name="username" value="username"/>
<property name="password" value="password"/>
</dataSource>
</environment>
</environments>
<mappers>
<mapper resource="mappers/ExampleMapperFile.xml"/>
</mappers>
</configuration>
Затем на это ссылаются в application.properties:
mybatis.config=classpath:MybatisConfig.xml
Дополнительные свойства mybatis:
#mybatis.mapperLocations=classpath*:**/mappers/*.xml
#mybatis.typeAliasesPackage=com.mydomain.package
#mybatis.typeHandlersPackage=handler's package
#mybatis.check-config-location=check the mybatis configuration exists
#mybatis.executorType=mode of execution. Default is SIMPLE