18 lines
696 B
Java
18 lines
696 B
Java
package uk.nowdoctor.demo1;
|
|
|
|
import java.util.concurrent.atomic.AtomicLong;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
@RestController
|
|
public class GreetingController {
|
|
public static final String template = "Sup %s nice to see your face but please quit bothering me thx.";
|
|
public final AtomicLong counter = new AtomicLong();
|
|
|
|
@GetMapping("/greeting")
|
|
public Greeting greeting(@RequestParam(value="name", defaultValue = "world") String name) {
|
|
return new Greeting (counter.incrementAndGet(), String.format(template, name));
|
|
}
|
|
} |