Skip to content

Commit 1021531

Browse files
committed
Kotlin + Spring demo
1 parent 0761a17 commit 1021531

13 files changed

Lines changed: 504 additions & 0 deletions

File tree

20211018/spring/.gitignore

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
.gradle
2+
build/
3+
!gradle/wrapper/gradle-wrapper.jar
4+
!**/src/main/**/build/
5+
!**/src/test/**/build/
6+
7+
### STS ###
8+
.apt_generated
9+
.classpath
10+
.factorypath
11+
.project
12+
.settings
13+
.springBeans
14+
.sts4-cache
15+
bin/
16+
!**/src/main/**/bin/
17+
!**/src/test/**/bin/
18+
19+
### IntelliJ IDEA ###
20+
.idea
21+
*.iws
22+
*.iml
23+
*.ipr
24+
out/
25+
!**/src/main/**/out/
26+
!**/src/test/**/out/
27+
28+
### NetBeans ###
29+
/nbproject/private/
30+
/nbbuild/
31+
/dist/
32+
/nbdist/
33+
/.nb-gradle/
34+
35+
### VS Code ###
36+
.vscode/

20211018/spring/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Kotlin + Spring demo
2+
3+
## 실행
4+
5+
Run tests:
6+
7+
```bash
8+
./gradlew test
9+
```
10+
11+
Build JAR:
12+
13+
```bash
14+
./gradlew bootJar
15+
```
16+
17+
Run web server:
18+
19+
```bash
20+
./gradlew bootRun
21+
```
22+
23+
<http://localhost:8080/>
24+
25+
## 기본 코드 생성
26+
27+
Spring Initializr 사용:
28+
<https://start.spring.io/>
29+
30+
## `WelcomeController` 테스트 및 구현 작성
31+
32+
참고:
33+
34+
- [Kotlin + Spring Boot 맛보기](https://github.com/ahastudio/til/blob/main/spring/2019-12-04-kotlin-spring.md)
35+
- [Building web applications with Spring Boot and Kotlin](https://spring.io/guides/tutorials/spring-boot-kotlin/)

20211018/spring/build.gradle.kts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
3+
plugins {
4+
id("org.springframework.boot") version "2.5.5"
5+
id("io.spring.dependency-management") version "1.0.11.RELEASE"
6+
kotlin("jvm") version "1.5.31"
7+
kotlin("plugin.spring") version "1.5.31"
8+
}
9+
10+
group = "com.example"
11+
version = "0.0.1-SNAPSHOT"
12+
java.sourceCompatibility = JavaVersion.VERSION_11
13+
14+
repositories {
15+
mavenCentral()
16+
}
17+
18+
dependencies {
19+
implementation("org.springframework.boot:spring-boot-starter-jooq")
20+
implementation("org.springframework.boot:spring-boot-starter-validation")
21+
implementation("org.springframework.boot:spring-boot-starter-web")
22+
23+
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
24+
implementation("org.jetbrains.kotlin:kotlin-reflect")
25+
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
26+
27+
developmentOnly("org.springframework.boot:spring-boot-devtools")
28+
29+
runtimeOnly("com.h2database:h2")
30+
runtimeOnly("org.postgresql:postgresql")
31+
32+
testImplementation("org.springframework.boot:spring-boot-starter-test")
33+
}
34+
35+
tasks.withType<KotlinCompile> {
36+
kotlinOptions {
37+
freeCompilerArgs = listOf("-Xjsr305=strict")
38+
jvmTarget = "11"
39+
}
40+
}
41+
42+
tasks.withType<Test> {
43+
useJUnitPlatform()
44+
}
58.1 KB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

20211018/spring/gradlew

Lines changed: 234 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)