Open
Description
I was reading the changelog for mybatis-spring-2.0.5 and noticed #458. Since I want to avoid XML configuration files, my usage of SqlSessionFactoryBean
looks like this:
@Bean
public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception {
var factory = new SqlSessionFactoryBean();
factory.setDataSource(dataSource);
// Mapper configuration
var configuration = new org.apache.ibatis.session.Configuration();
configuration.setAutoMappingBehavior(AutoMappingBehavior.FULL);
configuration.setMapUnderscoreToCamelCase(true);
configuration.setDefaultEnumTypeHandler(CustomEnumTypeHandler.class);
configuration.getTypeHandlerRegistry().register(LocalDate.class, CustomLocalDateTypeHandler.class);
factory.setConfiguration(configuration);
// Register the model classes as type aliases
factory.setTypeAliasesPackage(MyModel.class.getPackage().getName());
return factory.getObject();
}
#458 introduced another "layer" of option of the already existing Configuration
class for setDefaultEnumTypeHandler
. I went back to the documentation and noticed that the possibility of using Java configuration is not explained anywhere. Perhaps this could be added to the documentation? Or is one not supposed to use that api for configuration?