https://blog.csdn.net/LLcwh/article/details/115627280
接上一个博客的设置pom文件来做
pom.xml文件添加依赖
<!-- springboot整合mybatis -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.4</version>
</dependency>
创建实体类User
@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {
private int id;
private String name;
private int age;
}
yml读取配置
#mybatis相关配置
#<property name="mapperLocations" value="classpath:com/fullstack/mapper/*.xml"/>
#<property name="typeAliasesPackage" value="com.fullstack.pojo" />
Mybatis:
mapper-locations: classpath:com/fullstack/mapper/*.xml
type-aliases-package: com.fullstack.boot.pojo
pom.xml相关设置
<!-- springboot整合mybatis -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.4</version>
</dependency>
<resources>
<resource>
<directory>src/main/java</directory>