The following bit of config accepts a HTTP POST with a JSON request body of a User instance to create, but I'm danged if I can get it to return a 201 Created
. Any ideas?
@Bean
public IntegrationFlow flow(UserService userService) {
return IntegrationFlows.from(
Http.inboundGateway("/users")
.requestMapping(r -> r.methods(HttpMethod.POST))
.statusCodeFunction(f -> HttpStatus.CREATED)
.requestPayloadType(User.class)
.replyChannel(replyChannel())
.requestChannel(inputChannel())
)
.handle((p, h) -> userService.create((User) p)).get();
}
I tried calling statusCodeFunction
on the HttpRequestHandlerEndpointSpec
, but I must be doing it wrong.