Configuration database connection SpringBoot-
Configuration database connection SpringBoot-
In SpringBoot provided in the default database connector - chasing light by HikariCP, we just need to add jdbc launcher will automatically recover depends on the database connection pool's light.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
In addition, the need to introduce driver package database.
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
After two import-dependent, we also need to configure the database user name, password, URL, and a driving class.
Open application.yml, add the following configuration in the spring
spring:
datasource:
username: root
password: 1998
url: jdbc:mysql://localhost:3306/springboot?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC
driver-class-name: com.mysql.jdbc.Driver