@RequestParam validation

devKirin·2020년 8월 16일
0

Spring

목록 보기
2/2

@RequestParam 으로 정의된 요청 데이터의 Validation 방법
1. Controller class에 @Validate를 정의한다.
2. Validate 하고자 하는 @RequestParam에 validation annotation을 정의한다.

@RestController
@Validate
@Sl4j
public class TestController {
	@PostMapping(value="/test")
	public ResultInfo test(HttpServletRequest request
    			, @RequestParam("testId") @Min(1) int testId) {
		log.info("requested param = {}", testId);
	}
}
profile
Throw hat over the windmill

0개의 댓글