diff --git a/build.gradle.kts b/build.gradle.kts index 9b6b2cb..72f65fa 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -29,9 +29,8 @@ extra["springCloudVersion"] = "2021.0.5" dependencies { implementation("org.springframework.boot:spring-boot-starter-data-jpa") - implementation("org.springframework.boot:spring-boot-starter-oauth2-client") - implementation("org.springframework.boot:spring-boot-starter-security") - implementation("org.springframework.boot:spring-boot-starter-validation") +// implementation("org.springframework.boot:spring-boot-starter-oauth2-client") +// implementation("org.springframework.boot:spring-boot-starter-validation") implementation("org.springframework.boot:spring-boot-starter-web") implementation("com.fasterxml.jackson.module:jackson-module-kotlin") implementation("com.google.cloud:spring-cloud-gcp-starter") @@ -42,7 +41,7 @@ dependencies { runtimeOnly("com.mysql:mysql-connector-j") annotationProcessor("org.projectlombok:lombok") testImplementation("org.springframework.boot:spring-boot-starter-test") - testImplementation("org.springframework.security:spring-security-test") +// testImplementation("org.springframework.security:spring-security-test") } dependencyManagement { diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..0783da1 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3' +services: + mysql: + image: mysql:8-oracle + container_name: db_container1 + ports: + - "3308:3306" + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: facegram \ No newline at end of file diff --git a/src/main/kotlin/com/facegram/facegrambackend/domain/user/User.kt b/src/main/kotlin/com/facegram/facegrambackend/domain/user/User.kt new file mode 100644 index 0000000..0dd34ad --- /dev/null +++ b/src/main/kotlin/com/facegram/facegrambackend/domain/user/User.kt @@ -0,0 +1,40 @@ +package com.facegram.facegrambackend.domain.user + +import lombok.NoArgsConstructor +import java.lang.IllegalArgumentException +import javax.persistence.* + +@Entity +@NoArgsConstructor +class User constructor( + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + var id: Long? = null, + + @Column + var username: String + +) { + init{ + if(username.isBlank()){ + throw IllegalArgumentException("이름은 비어 있을 수 없습니다.") + } + } + + fun updateUsername(name: String){ + this.username = name + } + + companion object{ + fun newInstance( + username: String, + id: Long? = null + ): User{ + return User(id, username) + } + } + + + +} \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties deleted file mode 100644 index 8b13789..0000000 --- a/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..c9471af --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,31 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://localhost:3308/facegram?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&serverTimezone=Asia/Seoul + username: root + password: root + jpa: + hibernate: + ddl-auto: none + properties: + hibernate: + show_sql: true + format_sql: false + default_batch_fetch_size: 1000 +#spring: +# datasource: +# url: 'jdbc:h2:mem:facegram' +# username: 'user' +# password: '' +# driver-class-name: org.h2.Driver +# jpa: +# hibernate: +# ddl-auto: create +# properties: +# hibernate: +# format_sql: true +# show_sql: true +# h2: +# console: +# enabled: true +# path: '/h2-console' \ No newline at end of file