Skip to content

Commit 1cb2c8b

Browse files
committed
Add explanation for default sql provider type supported since MyBatis 3.5.6
Fixes gh-62
1 parent 6b2b6ae commit 1cb2c8b

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/main/asciidoc/user-guide.adoc

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,37 @@ public interface NameMapper extends BaseMapper {
12081208
}
12091209
----
12101210

1211+
[TIP]
1212+
====
1213+
Since the MyBatis 3.5.6, you can omit the `type` attribute at each annotations
1214+
when specify the default provider class as global configuration as follow:
1215+
1216+
.Mapper interface
1217+
[source, java]
1218+
----
1219+
public interface NameMapper extends BaseMapper {
1220+
@SelectProvider
1221+
List<Name> findByCondition(NameCondition condition);
1222+
}
1223+
----
1224+
1225+
.Java based configuration
1226+
[source, java]
1227+
----
1228+
Configuration configuration = new Configuration();
1229+
configuration.setDefaultSqlProviderType(TemplateFilePathProvider.class);
1230+
----
1231+
1232+
.XML based configuration
1233+
[source, xml]
1234+
----
1235+
<settings>
1236+
<setting name="defaultSqlProviderType" value="org.mybatis.scripting.thymeleaf.support.TemplateFilePathProvider"/>
1237+
</settings>
1238+
----
1239+
1240+
====
1241+
12111242
By default implementation, a template file path resolve following format and priority order.
12121243
If does not match all, it throw an exception that indicate not found a template file.
12131244

0 commit comments

Comments
 (0)