Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {

group = "com.example"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_11
java.sourceCompatibility = JavaVersion.VERSION_1_8

repositories {
mavenCentral()
Expand All @@ -32,6 +32,6 @@ tasks.withType<Test> {
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "11"
jvmTarget = "1.8"
}
}
8 changes: 8 additions & 0 deletions local.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Thu Aug 20 19:53:31 KST 2020
sdk.dir=/Users/zero/Library/Android/sdk
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

안드로이드는 이거 필요해요..??? 궁금궁금

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

헤카앱 안드로이드같은 경우는 기본 sdk 로 자바 8을 쓰고있어서 해당 경로가 기입된것 같습니다 ㅇㅅㅇ...

Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication

@SpringBootApplication
class KotlinwebApplication
class KotlinWebApplication

fun main(args: Array<String>) {
runApplication<KotlinwebApplication>(*args)
runApplication<KotlinWebApplication>(*args)
}
14 changes: 14 additions & 0 deletions src/main/kotlin/com/example/kotlinweb/config/BoardConfig.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.example.kotlinweb.config

import com.example.kotlinweb.model.Board
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration

@Configuration
class BoardConfig {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

배운 걸 잘 응용하셨네요 굿

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

꾸오오옹 아직은 잘 모르겠습니다 해리 감사해요 👍


@Bean
fun boardList(): MutableList<Board> {
return mutableListOf()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.example.kotlinweb.controller

import com.example.kotlinweb.model.Board
import com.example.kotlinweb.service.BoardService
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RestController

@RestController
class BoardController(private val boardService: BoardService) {

@PostMapping("/board")
fun postBoard(@RequestBody body: Board): Boolean {
return boardService.create(body)
}
}

This file was deleted.

8 changes: 8 additions & 0 deletions src/main/kotlin/com/example/kotlinweb/model/Board.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.example.kotlinweb.model

data class Board(
val id: Int,
val title: String,
val name: String,
val content: String
)
15 changes: 15 additions & 0 deletions src/main/kotlin/com/example/kotlinweb/service/BoardService.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.example.kotlinweb.service

import com.example.kotlinweb.model.Board
import org.springframework.stereotype.Service

@Service
class BoardService(
private val boardList: MutableList<Board>
) {
fun create(board: Board): Boolean {
boardList.add(board)
println("Board 생성 :$board")
return true
}
}
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@

server.port = 5050
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.junit.jupiter.api.Test
import org.springframework.boot.test.context.SpringBootTest

@SpringBootTest
class KotlinwebApplicationTests {
class KotlinWebApplicationTests {

@Test
fun contextLoads() {
Expand Down