Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import org.springframework.web.bind.annotation.RestController
class GreetingController {

companion object {
private const val template = "Hello, %s!"
private const val TEMPLATE = "Hello, %s!"
}
private val counter = AtomicLong()

@GetMapping("/greeting")
fun greeting(@RequestParam name: String = "World") =
Greeting(counter.incrementAndGet(), String.format(template, name))
Greeting(counter.incrementAndGet(), String.format(TEMPLATE, name))

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
@RestController
public class GreetingController {

private static final String template = "Hello, %s!";
private static final String TEMPLATE = "Hello, %s!";
private final AtomicLong counter = new AtomicLong();

@GetMapping("/greeting")
public Greeting greeting(@RequestParam(defaultValue = "World") String name) {
return new Greeting(counter.incrementAndGet(), String.format(template, name));
return new Greeting(counter.incrementAndGet(), String.format(TEMPLATE, name));
}
}