ciao!
ho un problemino con i path e le variabili da passare nell'url.
questo il controller:
quando vado su http://localhost:8080/greeting/GGG vedo sempre Nothing.codice:package com.mp.springkotlin import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RequestParam import org.springframework.web.bind.annotation.RestController import java.util.concurrent.atomic.AtomicLong @RestController class GreetingController { val counter = AtomicLong(); @RequestMapping("/greeting/{name}") fun greeting(@RequestParam(value = "name", defaultValue = "Nothing") name: String): Greeting { return Greeting(counter.incrementAndGet(), String.format("%s", name)); } }
in sostanza non si prende il valore passato.
questa la data class:
codice:package com.mp.springkotlin data class Greeting(val id: Long, val value: String)

Rispondi quotando