Skip to content

Commit 5c77a8e

Browse files
committed
Add explanation for SpringBootVFS
Fixes gh-201
1 parent 03c3bef commit 5c77a8e

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

mybatis-spring-boot-autoconfigure/src/site/xdoc/index.xml.vm

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636

3737
<ul>
3838
<li>Build standalone applications.</li>
39-
<li>Reduce the boilerplate to almost zero.</li>
40-
<li>Less XML configuration.</li>
41-
</ul>
39+
<li>Reduce the boilerplate to almost zero.</li>
40+
<li>Less XML configuration.</li>
41+
</ul>
4242

4343
</subsection>
4444

@@ -331,6 +331,32 @@ ConfigurationCustomizer mybatisConfigurationCustomizer() {
331331

332332
</subsection>
333333

334+
<subsection name="Using the SpringBootVFS">
335+
<p>
336+
The MyBatis-Spring-Boot-Starter provides the <code>SpringBootVFS</code> as an implementation class of <code>VFS</code>.
337+
The <code>VFS</code> is used for searching classes (e.g. target class of type alias, type handler class) from an application (or application server).
338+
If you run a Spring Boot application using the executable jar, you need to use the <code>SpringBootVFS</code>.
339+
The auto-configuration feature provided by the MyBatis-Spring-Boot-Starter used it automatically,
340+
but it does not use automatically by a manual configuration (e.g. when uses multiple <code>DataSource</code>).
341+
</p>
342+
343+
<p>
344+
How to use the <code>SpringBootVFS</code> on manual configuration:
345+
</p>
346+
347+
<source><![CDATA[
348+
// @Configuration class
349+
@Bean
350+
public SqlSessionFactory masterSqlSessionFactory() throws Exception {
351+
SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
352+
factoryBean.setDataSource(masterDataSource());
353+
factoryBean.setVfs(SpringBootVFS.class); // Sets the SpringBootVFS class into SqlSessionFactoryBean
354+
// ...
355+
return factoryBean.getObject();
356+
}
357+
]]></source>
358+
</subsection>
359+
334360
<subsection name="Detecting MyBatis components">
335361

336362
<p>The MyBatis-Spring-Boot-Starter will detects beans that implements following interface provided by MyBatis.</p>

0 commit comments

Comments
 (0)