We are currently converting from Wildfly to SpringBoot + Resteasy, and the last hurdle we have hit is validation that requires dependency injection.
The solution is using
- Spring boot 2.2.5.RELEASE
- resteasy-spring-boot-starter 3.3.1.Final
- resteasy-validator-provider-11 3.6.3.SP1
One of the validators with the issue has the following form
@Component
public class FieldsValidValidator implements ConstraintValidator<FieldsValidValid, RequestDTO> {
@Inject
private CancellationFieldController cancellationFieldController;
@Override
public boolean isValid(RequestDTO requestDTO, ConstraintValidatorContext context) {
var stuff = controller.getStuff(requestDTO.getStuffId()); // controller is null here
On Wildfly with weld and a @Stateless annotation the validator gets the controller injected, but I cannot figure out how to get it injected in Spring Boot, its like the hibernate-validator stuff is unaware of Spring Boots context.