Created
May 28, 2017 20:29
-
-
Save marco-mendes/27300d109915816f492aacc06a2aa4d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package hello; | |
import java.util.concurrent.atomic.AtomicLong; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
import org.springframework.web.bind.annotation.RequestParam; | |
import org.springframework.web.bind.annotation.RestController; | |
@RestController | |
public class GreetingController { | |
private static final String template = "Hello, %s!"; | |
private final AtomicLong counter = new AtomicLong(); | |
@RequestMapping("/greeting") | |
public Greeting greeting(@RequestParam(value="name", defaultValue="World") String name) { | |
return new Greeting(counter.incrementAndGet(), | |
String.format(template, name)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment