所需依赖 pom.xml
<!-- spring boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- mysql -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.34</version>
</dependency>
<!-- spring-boot mybatis -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
application.yml配置
# server
server:
port: 8080
# spring
spring:
datasource:
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/wechat?useUnicode=true&characterEncoding=utf-8
username: root
password: root
# mybatis
mybatis:
type-aliases-package: com.angus.wechataccount.wechat.entity
mapper-locations: classpath:mapper/*.xml
spring boot启动文件
需要在@SpringBootApplication配置下加一句
@MapperScan("com.angus.wechataccount.wechat.dao")