DeferredResult provides an alternative to using a Callable for asynchronous request processing. While a Callable is executed concurrently on behalf of the application, with a DeferredResult the application can produce the result from a thread of its choice.
Subclasses can extend this class to easily associate additional data or behavior with the DeferredResult. For example, one might want to associate the user used to create the DeferredResult by extending the class and adding an additional property for the user. In this way, the user could easily be accessed later without the need to use a data structure to do the mapping.
An example of associating additional behavior to this class might be realized by extending the class to implement an additional interface. For example, one might want to implement Comparable so that when the DeferredResult is added to a PriorityQueue it is handled in the correct order.
По факту заметил, что с DiferredRestult могу указывать сам пул потоков, а с Callable нет.
Как установить в ответ http-код 412 и одновременно отменить выполнение запросов типа POST, PUT, DELETE?
@GetMapping
Второй с аннотацией @RequestMapping("/")
или @PostMapping
для выше упомянутых случаев, и добавить в его параметры HttpServletResponse resp
В теле метода: resp.setStatus(412); return "redirect:error_page.html";
Можно сделать метод void или делать переадресацию.@PostMapping
Read Committed is the default isolation level in PostgreSQL.
melkij=> select 'hello'::xml;
xml
-------
hello
(1 строка)
melkij=> select '<foo>hello'::xml;
ERROR: invalid XML content
СТРОКА 1: select '<foo>hello'::xml;
^
ПОДРОБНОСТИ: line 1: Premature end of data in tag foo line 1
<foo>hello
^
line 1: chunk is not well balanced
<foo>hello
При этом по факту я спокойно вставляю в таблицу произвольную строку и никакой проверки не происходит, данные спокойно записываются в таблицу.