ok visto che ci siamo ho provato.
allora, in kotlin questo da errore in compilazione:
non ho ancora capito come risolverlo:codice:@GetMapping({"/greeting/{name}", "/greeting"}) fun greeting(@PathVariable(value = "name", required = false) name: String): Greeting { return Greeting(counter.incrementAndGet(), String.format("%s", name)); }
ho provato ad usare ;, ma ovviamente non è corretto.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)
se faccio così:
e vado su http://localhost:8080/greeting/, ottengo questo:codice:@GetMapping("/greeting/{name}") fun greeting(@PathVariable(value = "name", required = false) name: String): Greeting { return Greeting(counter.incrementAndGet(), String.format("%s", name)); }
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

Rispondi quotando