반응형

빌드 도구 gradle 사용

 

공통사항

 

application.properties - DB연결

spring.datasource.url=jdbc:mysql://localhost:3307/스키마명?useSSL=false&useUnicode=true&serverTimezone=Asia/Seoul
spring.datasource.username=유저명
spring.datasource.password=유저비밀번호

 

build.gradle - mysql 종속성 추가

dependencies {
    implementation 'mysql:mysql-connector-java:8.0.29'
    implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
    implementation 'org.springframework.boot:spring-boot-starter-web'

 


 

JPA 연동

 

build.gradle

implementation 'org.springframework.boot:spring-boot-starter-data-jpa'

 


 

myBatis 연동

 

build.gradle

implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2'

 

application.properties - mapper 패키지 추가 // db snake_case와 java camelCase 매핑 

mybatis.type-aliases-package = com.example.project.mapper
mybatis.configuration.map-underscore-to-camel-case=true

 

반응형

+ Recent posts