Reputation: 81
I have created a web application in spring boot in which I want to use Spring MVC rest framework instead of jersey. I am trying to do something like this but it gives me error. I want a equivalent of StreamingOutput in Spring MVC.
Ex: This uses JAX-RS StreamingOutput
public static StreamingOutput buildErrorEntity(Object error)
{
StreamingOutput stream = outputStream -> {
PrintStream printStream = new PrintStream(outputStream);
new ObjectMapper().writeValue(printStream, error);
};
return stream;
}
I want to replace SteamingOutput but it gives me an error saying "Cannot resolve constructor PrintStream()
public static OutputStream buildErrorEntity1(Object error) {
OutputStream stream = outputStream -> {
PrintStream printStream = new PrintStream(outputStream);
new ObjectMapper().writeValue(printStream, error);
};
return stream;
}
I would really appreciate some help. Thank you.
Upvotes: 7
Views: 4005