数据库访问
springboot整合使用JdbcTemplate
数据库中创建表
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(32) NOT NULL COMMENT '用户名称',
`age` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
pom.xml中引入依赖
<!-- SpringBoot整合JDBC模板框架-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<!-- SpringBoot整合mysql驱动类-->
<dependency>
<groupId>mysql</groupId>