<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<scope>runtime</scope>
</dependency>
配置
mybatis.type-aliases-package=org.namedlock.springboot.entity
# embeded database does not need to specify driverClassName & url
#spring.datasource.driverClassName = com.mysql.jdbc.Driver
#spring.datasource.url = jdbc:mysql://localhost:3306/test1?useUnicode=true&characterEncoding=utf-8
spring.datasource.username = sa
spring.datasource.password =
请查看UserMapper
org.namedlock.springboot.dao.mapper.UserMapper
@SpringBootApplication
//@MapperScan("org.namedlock.springboot.dao.mapper") //或者在mapper上标注 @Mapper
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
org.namedlock.springboot.UserMapperTest