1.首先创建一个SpringBoot的项目,使用的工具是eclipse,创建一个spring starter project
2.在maven中导入jar包
<?xml version="1.0" encoding="UTF-8"?>
4.0.0
org.springframework.boot
spring-boot-starter-parent
2.1.4.RELEASE
com.example
SpringBoot
0.0.1-SNAPSHOT
SpringBoot
Demo project for Spring Boot
1.8
org.springframework.boot
spring-boot-starter
org.springframework.boot
spring-boot-starter-test
test
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-devtools
true
org.springframework.boot
spring-boot-starter-jdbc
com.alibaba
fastjson
1.2.7
net.sf.json-lib
json-lib
2.4
jdk15
org.mybatis.spring.boot
mybatis-spring-boot-starter
1.3.1
mysql
mysql-connector-java
runtime
com.alibaba
druid
1.1.6
org.springframework.boot
spring-boot-maven-plugin
-------------------------------------------------------
因为添加了mybatis-spring-boot-starter
而我们现在还没有配置数据库的内容,所以直接运行会报错,找到启动的main,把@SpringBootApplication改为
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
3.运行测试