I have serious problem with (I guess hibernate validator). I''m using spring boot 2.0 and the problem exists even i spring boot 1.4.x and the correspondent version comes from:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
I have simple domain validation -
ExhibitorListt.class
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="id")
private Integer id;
@Column(name="exhibitor_name")
@NotBlank(message="The name of exhibitor cannot be empty!")
private String exhibitorName;
@Column(name="exhibitor_price")
@NotNull(message="Price must be a number")
private Double exhibitorPrice;
@Column(name="catalogue_number")
@NotNull(message="Catalogue number can not be empty!")
private Integer catalogueNumber;
@Column(name="oracle_number")
@NotBlank(message="Oracle number can not be empty")
private String oracleNumber;
And simple Spring MVC controller
@Secured({ "ROLE_ADMIN" })
@RequestMapping(value = "/new", method = RequestMethod.POST)
public String newExhibitor(Model model, @Valid ExhibitorList newExhibitor, BindingResult result, RedirectAttributes attr) {
if (result.hasErrors()) {
attr.addFlashAttribute("org.springframework.validation.BindingResult.newExhibitor", result);
attr.addFlashAttribute("newExhibitor", newExhibitor);
return "redirect:/exhibitor/new";
}
exhibitorListRepository.save(newExhibitor);
return "redirect:/exhibitor/new";
}
When I try to create new entity, the request takes 10 - 15 sec. I attache profiler to diagnostic the problem. It seems that it comes from hibernate-validation. I cannot reproduce the bug because it is not occurs every time, but from time to time... I tried many things but nothing helps ....
JSON from the profiler with call tree. http://80.241.211.242/sampleCallTree%20(1).json
Any suggestions are OK.