in verità avevo provato così come dici:
ma se poi vado su http://localhost:8080/greeting/ ottengo cmq questo:codice:@GetMapping("/greeting/{name}", "/greeting") fun greeting(@PathVariable(value = "name", required = false) name: String): Greeting { return Greeting(counter.incrementAndGet(), String.format("%s", name)); }
mentre in console vedo questo:codice:Whitelabel Error PageThis application has no explicit mapping for /error, so you are seeing this as a fallback. Sat Apr 18 18:40:32 CEST 2020 There was an unexpected error (type=Internal Server Error, status=500). Parameter specified as non-null is null: method com.mp.springkotlin.GreetingController.greeting, parameter name
quindi pensavo di aver sbagliato.codice:ERROR 23183 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: Parameter specified as non-null is null: method com.mp.springkotlin.GreetingController.greeting, parameter name] with root cause java.lang.IllegalArgumentException: Parameter specified as non-null is null: method com.mp.springkotlin.GreetingController.greeting, parameter name

Rispondi quotando