前言
本文是对SpringBoot使用JdbcTemplate操作数据库的一个介绍,提供一个小的Demo供大家参考。
操作数据库的方式有很多,本文介绍使用SpringBoot结合JdbcTemplate。
新建项目
新建一个项目。pom文件中加入Jdbc依赖,完整pom如下:
<?xml version="1.0" encoding="UTF-8"?>4.0.0 com.dalaoyang springboot_jdbc 0.0.1-SNAPSHOT jar springboot_jdbc springboot_jdbc org.springframework.boot spring-boot-starter-parent 1.5.9.RELEASE UTF-8 UTF-8 1.8 org.springframework.boot spring-boot-starter-jdbc org.springframework.boot spring-boot-devtools runtime mysql mysql-connector-java runtime org.springframework.boot spring-boot-starter-test test org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-maven-plugin