프로젝트를 생성해준다.
dependencies { implementation group: 'net.nurigo', name: 'javaSDK', version: '2.2' implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter' implementation group: 'mysql', name: 'mysql-connector-java', version: '8.0.32' implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-web' implementation group: 'com.google.guava', name: 'guava', version: '31.1-jre' compileOnly 'org.projectlombok:lombok' runtimeOnly 'mysql:mysql-connector-java' annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.springframework.boot:spring-boot-starter-test' }
bulid.gradle 안에 사용할 라이브러리를 추가해준다.
# localhost server.port=8088 # MySQL spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/sekkison?useSSL=false&serverTimezone=Asia/Seoul&allowPublicKeyRetrieval=true spring.datasource.username=sekkison spring.datasource.password=******* # SQL spring.jpa.show-sql=true spring.jpa.properties.hibernate.format_sql=true spring.jpa.hibernate.ddl-auto=update spring.mvc.view.prefix=/WEB-INF/views/ spring.mvc.view.suffix=.html
application.properties 안에 SQL을 사용하기 위한 기본설정을 해준다..
cmd을 열고 MySQL에 접속한다.CREATE DATABASE sekkison default CHARACTER SET UTF8; CREATE USER 'sekkison'@'localhost' IDENTIFIED BY '1234'; GRANT ALL PRIVILEGES ON sekkison.* TO 'sekkison'@'localhost'; FLUSH PRIVILEGES;
위 코드를 넣어주면 mySQL에 DB가 생성된다.
이후 springboot에 연결해주면 mySQL과 연동이 된다.