Tutorial on using JDBC templet in spring boot
preface
Spring's JDBC templet is a basic encapsulation of JDBC used by spring. He mainly helps programmers realize the management of database connection. There is no big difference between the other use methods and direct use of JDBC.
Business requirements
We are familiar with the use of JDBC. This is mainly to demonstrate the steps of using spring JDBC templet in springboot, so we design a simple requirement. Operation of curd of a user object. Object has two properties, one is ID and the other is name. Auth stored in MySQL_ In the user table.
Create new projects and add dependencies
Create an empty springboot project in IntelliJ idea. For specific steps, refer to the graphic tutorial of IntelliJ idea creating spring boot project. According to the requirements of this sample, we will add the following three dependencies
The code involved in this article has been uploaded to GitHub, and you can also download it locally