Skip to content

Commit e92c2f0

Browse files
committed
Migrate to Kotlin M14
1 parent 77449da commit e92c2f0

File tree

3 files changed

+42
-46
lines changed

3 files changed

+42
-46
lines changed

pom.xml

+36-39
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,52 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4-
<modelVersion>4.0.0</modelVersion>
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
55

6-
<groupId>org.test</groupId>
7-
<artifactId>demo</artifactId>
8-
<version>0.0.1-SNAPSHOT</version>
9-
<packaging>jar</packaging>
6+
<groupId>org.test</groupId>
7+
<artifactId>demo</artifactId>
8+
<version>0.0.1-SNAPSHOT</version>
9+
<packaging>jar</packaging>
1010

11-
<name>demo</name>
12-
<description>Demo project for Spring Boot</description>
11+
<name>demo</name>
12+
<description>Demo project for Spring Boot</description>
1313

14-
<parent>
15-
<groupId>org.springframework.boot</groupId>
16-
<artifactId>spring-boot-starter-parent</artifactId>
17-
<version>1.2.5.RELEASE</version>
18-
<relativePath/> <!-- lookup parent from repository -->
19-
</parent>
14+
<parent>
15+
<groupId>org.springframework.boot</groupId>
16+
<artifactId>spring-boot-starter-parent</artifactId>
17+
<version>1.2.5.RELEASE</version>
18+
<relativePath/> <!-- lookup parent from repository -->
19+
</parent>
2020

21-
<properties>
22-
<kotlin.version>0.13.1514</kotlin.version>
21+
<properties>
22+
<kotlin.version>0.14.449</kotlin.version>
23+
<java.version>1.8</java.version>
2324
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
24-
<java.version>1.8</java.version>
25-
</properties>
25+
</properties>
2626

27-
<dependencies>
28-
<dependency>
29-
<groupId>org.springframework.boot</groupId>
30-
<artifactId>spring-boot-starter-web</artifactId>
31-
</dependency>
32-
33-
<dependency>
34-
<groupId>org.springframework.boot</groupId>
35-
<artifactId>spring-boot-starter-test</artifactId>
36-
<scope>test</scope>
37-
</dependency>
27+
<dependencies>
28+
<dependency>
29+
<groupId>org.springframework.boot</groupId>
30+
<artifactId>spring-boot-starter-web</artifactId>
31+
</dependency>
32+
<dependency>
33+
<groupId>org.springframework.boot</groupId>
34+
<artifactId>spring-boot-starter-test</artifactId>
35+
<scope>test</scope>
36+
</dependency>
3837
<dependency>
3938
<groupId>org.jetbrains.kotlin</groupId>
4039
<artifactId>kotlin-stdlib</artifactId>
4140
<version>${kotlin.version}</version>
4241
</dependency>
4342
</dependencies>
44-
45-
<build>
46-
<plugins>
47-
<plugin>
48-
<groupId>org.springframework.boot</groupId>
49-
<artifactId>spring-boot-maven-plugin</artifactId>
50-
</plugin>
43+
44+
<build>
45+
<plugins>
46+
<plugin>
47+
<groupId>org.springframework.boot</groupId>
48+
<artifactId>spring-boot-maven-plugin</artifactId>
49+
</plugin>
5150
<plugin>
5251
<groupId>org.jetbrains.kotlin</groupId>
5352
<artifactId>kotlin-maven-plugin</artifactId>
@@ -81,7 +80,5 @@
8180
</executions>
8281
</plugin>
8382
</plugins>
84-
</build>
85-
86-
83+
</build>
8784
</project>

src/main/kotlin/demo/Application.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ package demo
22

33
import org.springframework.boot.SpringApplication
44
import org.springframework.boot.autoconfigure.SpringBootApplication
5-
import kotlin.platform.platformStatic
65

76
/**
87
*
98
* @author Benjamin Winterberg
109
*/
11-
SpringBootApplication
10+
@SpringBootApplication
1211
open class Application {
1312
companion object {
14-
platformStatic fun main(args: Array<String>) {
15-
SpringApplication.run(javaClass<Application>(), *args)
13+
@JvmStatic
14+
fun main(args: Array<String>) {
15+
SpringApplication.run(Application::class.java, *args)
1616
}
1717
}
1818
}

src/main/kotlin/demo/GreetingController.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
package demo
22

33
import org.springframework.web.bind.annotation.RequestMapping
4-
import org.springframework.web.bind.annotation.RequestParam
54
import org.springframework.web.bind.annotation.RestController
65
import java.util.concurrent.atomic.AtomicLong
76

8-
RestController
7+
@RestController
98
class GreetingController {
109

1110
val idGenerator = AtomicLong()
1211

13-
RequestMapping("/hello")
12+
@RequestMapping("/hello")
1413
fun hello(name: String): Greeting {
1514
val id = idGenerator.incrementAndGet()
1615
return Greeting(id, "$name, from Kotlin!")

0 commit comments

Comments
 (0)