Description
I consider to support auto-configure for following language drivers.
Specifications
In this change, following specification changes applied.
Auto configuration of language driver bean
Support to configure above three plugin language driver bean when same type bean not present in DI container.
Detecting language driver bean
Support to detect a language driver bean from DI container. You can register any scripting language driver to MyBatis and If target bean count is one, it has been configured to the default scripting language driver.
@Bean
MyLanguageDriver myLanguageDriver() {
return new MyLanguageDriver();
}
Customization for ThymeleafLanguageDriver
Support to customize a ThymeleafLanguageDriver creating by auto-configure (= detecting a ThymeleafLanguageDriverConfig
bean). You can customize it as follow:
@Bean
ThymeleafLanguageDriverConfig thymeleafLanguageDriverConfig() {
return ThymeleafLanguageDriverConfig.newInstance(c -> {
// ... customization code
});
}
Configuration property for default scripting language driver
Support to set a default scripting language driver by configuration property as follow:
mybatis.default-scripting-language-driver=FQCN
About no backward compatibility
Description
In this change, there is no backward compatibility for existing application when the following all conditions are matched (Please be careful when updating).
- The plugin language driver(mybatis-freemarker,mybatis-velocity, mybatis-thymeleaf) included one in classpath (= used one of plugin language driver)
- The default scripting language is not plugin language driver(= used built-in language driver(
XMLLanguageDriver
,RawLanguageDriver
) or custom language driver).
If above all conditions are matched, auto-configure of new version set the plugin language driver to default language driver.
Solution for broken backward compatibility
Please set the default scripting language driver using new configuration property(mybatis.default-scripting-language-driver
).
e.g.) When you use the XMLLanguageDriver
as default language driver
mybatis.default-scripting-language-driver=org.apache.ibatis.scripting.xmltags.XMLLanguageDriver
How to exclude this change
If you want to ignore this change, please set configuration property as follow:
spring.autoconfigure.exclude=org.mybatis.spring.boot.autoconfigure.MybatisLanguageDriverAutoConfiguration
Note
This change depends on mybatis-spring 2.0.2.