javavalidationjakarta-ee

javax validation has be replaced by jakarta validation, then validation can't work


    @RequestMapping(value = "/v3/{versionId}/start/info/{type}", method = RequestMethod.GET,
        headers = "Content-Type=application/json", produces = "application.json")
    public ResponseEntity<Response> getStartInfo(
            @RequestHeader(value = "X-language") String language,
            @RequestParam(Required = false)
            @Pattern(regexp = RegexPattern.TYPE, message = "DBS.280232") String type,
            HttpServletRequest request
    ) {

we use "javax.validation.constraints.Pattern" class at first, but our credibility told us can't use javax any more, so we replace it to "jakarta.validation.constraints.Pattern", but it can't validate param. (the param "type" is from url)

Has anyone come across this before,thanks!


Solution

  • Spring Boot 2.X does not support Jakarta EE, but support will come with Spring Boot 3.X. https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0.0-M1-Release-Notes