Configuring MyBatis using Java API
In the previous section, we have discussed various MyBatis configuration elements, such as environments, typeAliases, and typeHandlers, and how to configure them using XML. Even though you want to use the Java-API-based MyBatis configuration, it would be good to go through the previous section to have a better idea about these configuration elements. In this section, we will be referring to some of the classes described in the previous section.
SqlSessionFactory interface can be created programmatically using the Java API instead of using the XML-based configuration. Each configuration element used in an XML-based configuration can be created programmatically.
We can create the
SqlSessionFactory object ...