使用kotlin开发springboot应用
1
2
3
4
5
|
< dependency >
< groupId >org.jetbrains.kotlin</ groupId >
< artifactId >kotlin-stdlib</ artifactId >
< version >${kotlin.version}</ version >
</ dependency >
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
< plugin >
< groupId >org.jetbrains.kotlin</ groupId >
< artifactId >kotlin-maven-plugin</ artifactId >
< version >${kotlin.version}</ version >
< executions >
< execution >
< id >compile</ id >
< phase >compile</ phase >
< goals >
< goal >compile</ goal >
</ goals >
< configuration >
< sourceDirs >${project.basedir}/src/main/kotlin</ sourceDirs >
</ configuration >
</ execution >
< execution >
< id >test-compile</ id >
< phase >test-compile</ phase >
< goals >
< goal >test-compile</ goal >
</ goals >
< configuration >
< sourceDirs ></ sourceDirs >
</ configuration >
</ execution >
</ executions >
</ plugin >
|
@RestController class CustomerController (val repository:CustomerRepository) { @GetMapping("/") fun findAll() = repository.findAll() @GetMapping("/{name}") fun findByLastName(@PathVariable name:String) = repository.findByLastName(name)}