Created
May 17, 2020 20:26
-
-
Save j-tim/473d55e5f2a677f18608d18c650586c7 to your computer and use it in GitHub Desktop.
Spring MVC Restcontroller - Validation
This file contains hidden or 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 com.example.validation; | |
import lombok.extern.slf4j.Slf4j; | |
import org.springframework.web.bind.annotation.PostMapping; | |
import org.springframework.web.bind.annotation.RequestBody; | |
import org.springframework.web.bind.annotation.RestController; | |
import javax.validation.Valid; | |
@Slf4j | |
@RestController | |
public class CustomerController { | |
@PostMapping | |
public void createCustomer(@Valid @RequestBody Customer customer) { | |
log.info("Valid customer: {}", customer); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment