ok visto che ci siamo ho provato.
allora, in kotlin questo da errore in compilazione:
codice:
@GetMapping({"/greeting/{name}", "/greeting"})
fun greeting(@PathVariable(value = "name", required = false) name: String): Greeting {
return Greeting(counter.incrementAndGet(), String.format("%s", name));
}
non ho ancora capito come risolverlo:
codice:
[ERROR] Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.3.71:compile (compile) on project spring-kotlin: Compilation failure
[ERROR] /home/matte-server/Documenti/spring-kotlin/src/main/kotlin/com/mp/springkotlin/GreetingController.kt:[10,36] Unexpected tokens (use ';' to separate expressions on the same line)
ho provato ad usare ;, ma ovviamente non è corretto.
se faccio così:
codice:
@GetMapping("/greeting/{name}")
fun greeting(@PathVariable(value = "name", required = false) name: String): Greeting {
return Greeting(counter.incrementAndGet(), String.format("%s", name));
}
e vado su http://localhost:8080/greeting/, ottengo questo:
codice:
Whitelabel Error PageThis application has no explicit mapping for /error, so you are seeing this as a fallback.
Sat Apr 18 14:42:30 CEST 2020
There was an unexpected error (type=Not Found, status=404).
No message available