标签:
首先,MyBatis-Spring-Boot-Starter will:
Property | Description |
---|---|
config-location | MyBatis xml config file (optional) |
mapper-locations | Mapper xml config files (optional) |
type-aliases-package | Package to search for type aliases (optional) |
type-handlers-package | Package to search for type aliases (optional) |
executor-type | Executor type: SIMPLE, REUSE, BATCH (optional) |
configuration | A MyBatis Configuration bean. About available properties see the MyBatis reference page. NOTE This property cannot use at the same time with the config-location. |
#application.properties
mybatis.config-location=mybatis-config.xml
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <typeAliases> <package name="sample.mybatis.domain"/> </typeAliases> <mappers> <mapper resource="sample/mybatis/mapper/CityMapper.xml"/> <mapper resource="sample/mybatis/mapper/HotelMapper.xml"/> </mappers> </configuration>
#application.properties
mybatis.type-aliases-package=com.expert.pojo
package com.expert.dao;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import com.expert.pojo.User;
@Mapper
public interface UserMapper {
// @Select("SELECT * FROM user WHERE id = #{ id }")
User getById(String id);
@Select("SELECT * FROM user WHERE id = #{ id }")
User getById2(String id);
}
标签:
原文地址:http://www.cnblogs.com/larryzeal/p/5874107.html