I have a my batis (3.2.7) application, and I'm creating configuration using java code ( not xml ) as following.
public static Configuration getConfiguration(DataSet data) {
if (configuration == null) {
DataSource dataSource = getDataSource(DRIVER, URL, data.getUsername(), data.getPassword());
TransactionFactory transactionFactory = new JdbcTransactionFactory();
Environment environment =
new Environment("development", transactionFactory, dataSource);
configuration = new Configuration(environment);
}
return configuration;
}
Using above configuration sql session factory is created.
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(configuration);
My mappers are in xml format ( I need these in xml format), and currently in same package as mapper interface. I'm using following code to add mappers.
configuration.addMapper(CrudMapper.class);
This will automatically add xml mappers which are in same folder as mapper interface ( CrudMapper). But I need to move these xml file to resource folder. So mapper interface will be in one location, and xml mappers are in different location. I could not found any way to add xml mappers to configuration. Is there a way to do this ?