I’m programming a web site backend but I going have a problem with annotation @Pattern(). In this code I have a compcomponent and it should have a 2 digit value
This is my DTO `package med.absolut.api.endereco;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
public record DadosEndereco(
@NotBlank
String logradouro,
@NotBlank
String bairro,
@NotBlank
@Pattern(regexp = "\d{8}")
String cep,
@NotBlank
String cidade,
@NotBlank
@Pattern(regexp = "\d{2}")
String uf,
String numero,
String complemento){
}
`
but the console exit is an org.springframework.web.bind.MethodArgumentNotValidException
New contributor
Eduardo Hauer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.