I used XML configuration, but not Spring, and set the property inside the Configuration object, but found that it had to be done before the map files were loaded (see here ). I abandoned the “Configuration Object” object and went with the approach that worked for me:
Reader reader = Resources.getResourceAsReader("..../mybatis-config.xml"); Properties properties = new Properties(); properties.setProperty("dbname", "mydb"); SqlSessionFactory.factory = new SqlSessionFactoryBuilder().build(reader, "development", properties);
Then, as Andy Pryor wrote, use select * from ${dbname} in the XML converter.
source share