Reputation: 23
I am using SpringBoot 2.0 with Spring Integration 5.0.3 and have an issue with my HTTP.inboundGateway. My goal is to validate the JSON posted to the gateway, because the request pojo consists of mandatory fields.
@Bean
public IntegrationFlow notifyUpdateVehicleFlow() {
return IntegrationFlows.from(Http.inboundGateway("/update")
.requestMapping(r -> r.methods(HttpMethod.POST))
.requestPayloadType(RequestPojo.class)
.requestChannel(updateChannel())
.replyChannel(updateReplyChannel()))
.get();
}
Is there an easy way to validate fields in the pojo have been set? What I have already tested is using @NotNull SpringValidation but it seems not to be supported with Spring Integration.
Greetings, smoothny
Upvotes: 1
Views: 433
Reputation: 121382
There is no such a functionality in the Spring Integration. You can use .filter()
downstream that Http.inboundGateway()
and really perform Validator.validate()
from there on the payload.
If you think it must be done somehow on the Http.inboundGateway()
and you have strong requirements and clean description, feel free to raise a JIRA on the matter and we will discuss what can be done from the Framework perspective.
Upvotes: 1