---恢复内容开始---
项目结构
gradle配置文件:
dependencies { compile('org.springframework.boot:spring-boot-starter-cache') compile('org.springframework.boot:spring-boot-starter-data-redis') compile('org.springframework.boot:spring-boot-starter-web') compile('org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.2') compile('org.springframework.boot:spring-boot-starter-jdbc') runtime('mysql:mysql-connector-java') testCompile('org.springframework.boot:spring-boot-starter-test') }
application.yml
spring:
datasource:
url: jdbc:mysql://localhost:3306/test?characterEncoding=utf8&useSSL=false
username: root
password: root
driver-class-name: com.mysql.jdbc.Driver
redis:
host: 140.143.1.xx //ip地址
mybatis:
configuration:
map-underscore-to-camel-case: true #开启驼峰命名匹配
student实体类
public class Student implements Serializable { private Integer id; private String name; private Integer age; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } }