Notice how my controller is
@PostMapping("/anexo")
public DeferredResult<String> uploadAnexo(@RequestParam("files[]") MultipartFile[] files){
DeferredResult<String> resultado = new DeferredResult<>();
// retorno assíncrono
Thread thread = new Thread(new FotoStorageRunnable(files, resultado));
thread.start();
return resultado;
}
And see how my Thread is
import org.springframework.web.context.request.async.DeferredResult;
import org.springframework.web.multipart.MultipartFile;
public class FotoStorageRunnable implements Runnable {
private MultipartFile[] files;
private DeferredResult<String> resultado;
public FotoStorageRunnable(MultipartFile[] files, DeferredResult<String> resultado) {
this.files = files;
this.resultado = resultado;
}
@Override
public void run() {
System.out.println(">>> files: " + files[0].getSize());
resultado.setResult("ok! esse é o resultado foto recebida");
}
}
This message should have arrived on the server;
System.out.println(">>> files: " + files[0].getSize());
And these messages should have arrived on the client;
resultado.setResult("ok! esse é o resultado foto recebida");
Neither of these two messages arrived and still generated this error message just below;
Where is it wrong?