일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- development
- mysql
- apache
- 스프링부트 #springboot #project #Intellij
- restapi
- SpringSecurity
- Tomcat #SpringFramework
- RESTful
- 환경변수
- undefined
- springboot
- 스프링부트
- Maven
- IntelliJ
- tcping
- 스프링시큐리티
- oracle
- ojdbc
- HATEOAS
- mssql
- Developer
- install
- SpringInitializer
- postman
- Web
- 웹개발
- Database
- Oracle11g
- sqldeveloper
- springboot #controller #jsp
Archives
- Today
- Total
여백에 도장 찍기
Spring boot - MySQL 연동 본문
Environment
- Mac OS X
- IntelliJ IDEA
- Maven 3.3
- Spring boot 2.1.6
- MySQL 8.0.16
- 설치 참조 :: https://jum-dev.tistory.com/79
Spring boot 에서 MySQL 연동해보자.
1. pom.xml 에 관련 dependency를 추가.
<!-- MyBatis -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.0.0</version>
</dependency>
<!-- MySQL -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.15</version>
</dependency>
2. application.properties 파일에 DB connection 관련 정보를 추가해본다.
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/testdb
spring.datasource.username=testuser
spring.datasource.password=testpwd
Comments