[Spring Boot] MariaDB 연동 및 Mybatis 사용하기 HikariPool 이거 쓰는 법
페이지 정보
본문
MariaDB 연동 및 Mybatis 사용법 정리 글입니다.
HikariPool 이거 쓸려면 pom.xml 에서
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.4</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
이렇게 하고
application.properties 에서
#요거는 안됨
#spring.datasource.hikari.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.hikari.jdbc-url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8
#spring.datasource.hikari.username=사용자 계정
#spring.datasource.hikari.password=비밀번호
#요거는 됨
spring.datasource.url=jdbc:mysql://localhost:3306/test?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=UTC
spring.datasource.username=사용자 계정
spring.datasource.password=비밀번호
#Mybatis
mybatis.mapper-locations = mapper/*.xml
이렇게 해랑.
HikariPool 이거 쓸려면 pom.xml 에서
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.4</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
이렇게 하고
application.properties 에서
#요거는 안됨
#spring.datasource.hikari.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.hikari.jdbc-url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8
#spring.datasource.hikari.username=사용자 계정
#spring.datasource.hikari.password=비밀번호
#요거는 됨
spring.datasource.url=jdbc:mysql://localhost:3306/test?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=UTC
spring.datasource.username=사용자 계정
spring.datasource.password=비밀번호
#Mybatis
mybatis.mapper-locations = mapper/*.xml
이렇게 해랑.
관련링크
-
https://team404.tistory.com/16
2667회 연결 -
https://bamdule.tistory.com/28
3338회 연결
- 이전글SLF4J 이용하여 로그 남기는 방법 (with Logback) 21.06.17
- 다음글ActiveMQ 정리 21.06.15
댓글목록
등록된 댓글이 없습니다.