Fight the Future

Java言語とJVM、そしてJavaエコシステム全般にまつわること

Use @GetMapping, @PostMapping in Spring 4.3 or later

I always use @RequestMapping in Controller.

@Controller
public class TestController {
    @RequestMapping(value = "test", method = RequestMethod.GET)
    public String index() {

But in Spring 4.3, @GetMapping and @PostMappiing are provided. I was not sure about that.

So we don't need to write such a long statement. Just write below:

@Controller
public class TestController {
    @GetMapping("test")
    public String index() {