{"id":325757,"date":"2021-06-30T15:01:02","date_gmt":"2021-06-30T15:01:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=325757"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=325757","title":{"rendered":"\u0420\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435\u00a0\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043e Spring, \u0447\u0430\u0441\u0442\u044c\u00a04 R2DBC"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u042d\u0442\u043e \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0430\u044f \u0447\u0430\u0441\u0442\u044c <a href=\"https:\/\/habr.com\/ru\/post\/565000\/\" rel=\"noopener noreferrer nofollow\"><u>\u0441\u0435\u0440\u0438\u0438 \u0437\u0430\u043c\u0435\u0442\u043e\u043a \u043e \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438<\/u><\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 R2DBC \u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u043e, \u043a\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Spring Data R2DBC \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<h3>1. \u0427\u0422\u041e \u0422\u0410\u041a\u041e\u0415 R2DBC?<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0435\u0449\u0435 \u043d\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438, \u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0432\u0430\u043c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/habr.com\/ru\/post\/565004\/\" rel=\"noopener noreferrer nofollow\"><u>\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/u><\/a>, \u0432&nbsp;\u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u043e\u0442\u0438\u0432\u0430\u0446\u0438\u044f, \u043b\u0435\u0436\u0430\u0449\u0430\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u0435 \u044d\u0442\u043e\u0439 \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>\u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, JDBC \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0439 API.<\/p>\n<p>R2DBC \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442&nbsp;<code>Reactive Relational Database Connectivity <\/code>\u0438 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 SQL \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e API.&nbsp;\u041e\u043d \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 Reactive Streams \u0438 \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 SPI (Service Provider Interface   &#8212; \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430 \u0443\u0441\u043b\u0443\u0433) \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0430\u0432\u0442\u043e\u0440\u043e\u0432 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0435 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u043a\u043e\u0434\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u0434\u043b\u044f Oracle, Microsoft SQL Server, MySQL, PostgreSQL, H2, MariaDB \u0438 Google Cloud Spanner.<\/p>\n<h3>2. SPRING DATA R2DBC<\/h3>\n<p>Spring Data \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442 R2DBC &#8212; Spring Data R2DBC.<\/p>\n<p>\u042d\u0442\u043e \u043d\u0435 \u043f\u043e\u043b\u043d\u044b\u0439 ORM, \u043a\u0430\u043a JPA &#8212; \u043e\u043d \u043d\u0435 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0442\u0430\u043a\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043a\u0430\u043a \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u043b\u0438 \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u0430\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430.&nbsp;\u041d\u043e \u043e\u043d \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044e \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 StudentController \u0438\u0437 <a href=\"https:\/\/habr.com\/ru\/post\/565056\/\" rel=\"noopener noreferrer nofollow\"><u>\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0438 \u043e WebFlux<\/u><\/a>:<\/p>\n<pre><code class=\"java\">@RestController @RequestMapping(\"\/students\") public class StudentController {      @Autowired     private StudentService studentService;       public StudentController() {     }      @GetMapping(\"\/{id}\")     public Mono&lt;ResponseEntity&lt;Student&gt;&gt; getStudent(@PathVariable long id) {         return studentService.findStudentById(id)                 .map(ResponseEntity::ok)                 .defaultIfEmpty(ResponseEntity.notFound().build());     }      @GetMapping     public Flux&lt;Student&gt; listStudents(@RequestParam(name = \"name\", required = false) String name) {         return studentService.findStudentsByName(name);     }      @PostMapping     public Mono&lt;Student&gt; addNewStudent(@RequestBody Student student) {         return studentService.addNewStudent(student);     }      @PutMapping(\"\/{id}\")     public Mono&lt;ResponseEntity&lt;Student&gt;&gt; updateStudent(@PathVariable long id, @RequestBody Student student) {         return studentService.updateStudent(id, student)                 .map(ResponseEntity::ok)                 .defaultIfEmpty(ResponseEntity.notFound().build());     }      @DeleteMapping(\"\/{id}\")     public Mono&lt;ResponseEntity&lt;Void&gt;&gt; deleteStudent(@PathVariable long id) {         return studentService.findStudentById(id)                 .flatMap(s -&gt;                         studentService.deleteStudent(s)                                 .then(Mono.just(new ResponseEntity&lt;Void&gt;(HttpStatus.OK)))                 )                 .defaultIfEmpty(new ResponseEntity&lt;&gt;(HttpStatus.NOT_FOUND));     } }<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0430\u0434 \u0443\u0447\u0430\u0449\u0438\u043c\u0438\u0441\u044f.&nbsp;\u041c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 StudentService \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439.&nbsp;\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043b\u0435\u0436\u0430\u0449\u0443\u044e \u0432 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 REST, \u0438 \u0442\u043e, \u043a\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e R2DBC.<\/p>\n<h4>2.1 \u041f\u0420\u0418\u041c\u0415\u0420 \u0420\u0415\u0410\u041b\u0418\u0417\u0410\u0426\u0418\u0418<\/h4>\n<p><strong>2.1.1 \u0417\u0410\u0412\u0418\u0421\u0418\u041c\u041e\u0421\u0422\u0418<\/strong><\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u0430\u0440\u0443 \u043d\u043e\u0432\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439:<\/p>\n<pre><code class=\"xml\">&lt;dependencies&gt;         &lt;dependency&gt;             &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;             &lt;artifactId&gt;spring-boot-starter-data-r2dbc&lt;\/artifactId&gt;         &lt;\/dependency&gt;          &lt;dependency&gt;             &lt;groupId&gt;io.r2dbc&lt;\/groupId&gt;             &lt;artifactId&gt;r2dbc-postgresql&lt;\/artifactId&gt;             &lt;scope&gt;runtime&lt;\/scope&gt;         &lt;\/dependency&gt;         ... &lt;\/dependencies&gt; <\/code><\/pre>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c spring-boot-starter-data-r2dbc, \u0447\u0442\u043e\u0431\u044b \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c spring-data-r2dbc.&nbsp;\u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 postgresql, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c r2dbc-postgresql, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 r2dbc.<\/p>\n<p><strong>2.1.2 \u041a\u041e\u041d\u0424\u0418\u0413\u0423\u0420\u0410\u0426\u0418\u042f \u0411\u0410\u0417\u042b \u0414\u0410\u041d\u041d\u042b\u0425<\/strong><\/p>\n<p>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043b\u0438\u0431\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u0435\u0442\u0430\u043b\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u043d\u0430\u0448\u0435\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 application.properties:<\/p>\n<pre><code class=\"bash\">spring.r2dbc.url=r2dbc:postgresql:\/\/localhost\/studentdb spring.r2dbc.username=user spring.r2dbc.password=secret<\/code><\/pre>\n<p>\u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 Java:<\/p>\n<pre><code class=\"java\">import io.r2dbc.spi.ConnectionFactories; import io.r2dbc.spi.ConnectionFactory; import io.r2dbc.spi.ConnectionFactoryOptions; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration;  import static io.r2dbc.spi.ConnectionFactoryOptions.*;  @Configuration public class R2DBCConfig {      @Bean     public ConnectionFactory connectionFactory() {         return ConnectionFactories.get(                 ConnectionFactoryOptions.builder()                         .option(DRIVER, \"postgresql\")                         .option(HOST, \"localhost\")                         .option(USER, \"user\")                         .option(PASSWORD, \"secret\")                         .option(DATABASE, \"studentdb\")                         .build());     } }<\/code><\/pre>\n<p><strong>2.1.3 STUDENTSERVICE<\/strong><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 StudentService, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 StudentController:<\/p>\n<pre><code class=\"java\">@Service public class StudentService {      @Autowired     private StudentRepository studentRepository;      public StudentService() {     }      public Flux&lt;Student&gt; findStudentsByName(String name) {         return (name != null) ? studentRepository.findByName(name) : studentRepository.findAll();     }      public Mono&lt;Student&gt; findStudentById(long id) {         return studentRepository.findById(id);     }      public Mono&lt;Student&gt; addNewStudent(Student student) {         return studentRepository.save(student);     }      public Mono&lt;Student&gt; updateStudent(long id, Student student) {         return studentRepository.findById(id)                 .flatMap(s -&gt; {                     student.setId(s.getId());                     return studentRepository.save(student);                 });      }      public Mono&lt;Void&gt; deleteStudent(Student student) {         return studentRepository.delete(student);     }  }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 StudentRepository \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u0434 \u0443\u0447\u0430\u0449\u0438\u043c\u0438\u0441\u044f.&nbsp;\u0418\u0442\u0430\u043a, \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439.  <\/p>\n<p><strong>2.1.4 STUDENTREPOSITORY<\/strong><\/p>\n<p>StudentRepository &#8212; \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f&nbsp;<a href=\"https:\/\/docs.spring.io\/spring-data\/commons\/docs\/current\/api\/org\/springframework\/data\/repository\/reactive\/ReactiveCrudRepository.html\" rel=\"noopener noreferrer nofollow\"><u>ReactiveCrudRepository<\/u><\/a>.&nbsp;\u042d\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0438\u0437 Spring Data R2DBC \u0434\u043b\u044f \u043e\u0431\u0449\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 CRUD \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u0438\u043f\u043e\u0432 Project Reactor.&nbsp;\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 ReactiveCrudRepository \u0443\u0436\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432 StudentService (findAll, findById, save \u0438 delete), \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"java\">public interface StudentRepository extends ReactiveCrudRepository&lt;Student, Long&gt; { &lt;span class=\"token keyword\" style=\"box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; color: rgb(0, 119, 170);\"&gt;public&lt;\/span&gt; Flux&lt;span class=\"token operator\" style=\"box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; color: rgb(166, 127, 89); background: rgba(255, 255, 255, 0.5);\"&gt;&amp;lt;&lt;\/span&gt;Student&lt;span class=\"token operator\" style=\"box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; color: rgb(166, 127, 89); background: rgba(255, 255, 255, 0.5);\"&gt;&amp;gt;&lt;\/span&gt; &lt;span class=\"token function\" style=\"box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline;\"&gt;findByName&lt;span class=\"token punctuation\" style=\"box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; color: rgb(153, 153, 153);\"&gt;(&lt;\/span&gt;&lt;\/span&gt;String name&lt;span class=\"token punctuation\" style=\"box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; color: rgb(153, 153, 153);\"&gt;)&lt;\/span&gt;&lt;span class=\"token punctuation\" style=\"box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; color: rgb(153, 153, 153);\"&gt;;&lt;\/span&gt;  }<\/code><\/pre>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e @Query \u043a \u043c\u0435\u0442\u043e\u0434\u0443 \u0438 \u0443\u043a\u0430\u0437\u0430\u0432 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 sql.<\/p>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e ReactiveCrudRepository, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435&nbsp;<a href=\"https:\/\/docs.spring.io\/spring-data\/commons\/docs\/current\/api\/org\/springframework\/data\/repository\/reactive\/ReactiveSortingRepository.html\" rel=\"noopener noreferrer nofollow\"><u>ReactiveSortingRepository,<\/u><\/a>&nbsp;\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<p><strong>2.1.5 STUDENT<\/strong><\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e Student:  <\/p>\n<pre><code class=\"java\">import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.Table;  @Data @AllArgsConstructor @NoArgsConstructor @Table public class Student {      @Id     private Long id;     private String name;     private String address;  }<\/code><\/pre>\n<p>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0439:<\/p>\n<ul>\n<li>\n<p>\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0430\u043d\u043d\u043e\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 Spring Data @Id.<\/p>\n<\/li>\n<li>\n<p>\u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 @Table \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b, \u043d\u043e \u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043a\u0430\u043d\u0435\u0440\u0443 \u043f\u0443\u0442\u0438 \u043a \u043a\u043b\u0430\u0441\u0441\u0430\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0438 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0434\u043b\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445.&nbsp;\u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u0435 \u0435\u0433\u043e, \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>Lombok \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u0442\u044c \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0432&nbsp;<a href=\"https:\/\/docs.spring.io\/spring-data\/r2dbc\/docs\/current\/reference\/html\/#mapping.general-recommendations\" rel=\"noopener noreferrer nofollow\"><u>\u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/u><\/a>.<\/p>\n<\/li>\n<\/ul>\n<p><strong>2.1.6 \u0414\u0420\u0423\u0413\u0418\u0415 \u0412\u0410\u0420\u0418\u0410\u041d\u0422\u042b \u0417\u0410\u041f\u0420\u041e\u0421\u041e\u0412<\/strong><\/p>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e SQL \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f&nbsp;<a href=\"https:\/\/docs.spring.io\/spring-framework\/docs\/current\/javadoc-api\/org\/springframework\/r2dbc\/core\/DatabaseClient.html\" rel=\"noopener noreferrer nofollow\"><u>DatabaseClient<\/u><\/a>.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435\u0445 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432:<\/p>\n<pre><code class=\"java\"> public Flux&lt;Student&gt; findAll() {         DatabaseClient client = DatabaseClient.create(connectionFactory);         return client.sql(\"select * from student\")                 .map(row -&gt; new Student(row.get(\"id\", Long.class),                         row.get(\"name\", String.class),                         row.get(\"address\", String.class))).all();  }<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c&nbsp;<a href=\"https:\/\/docs.spring.io\/spring-data\/r2dbc\/docs\/current\/api\/org\/springframework\/data\/r2dbc\/core\/R2dbcEntityTemplate.html\" rel=\"noopener noreferrer nofollow\"><u>R2dbcEntityTemplate<\/u><\/a>&nbsp;\u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044f\u043c\u0438.&nbsp;\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<pre><code class=\"java\">@Autowired private R2dbcEntityTemplate template; public Flux&lt;Student&gt; findAll() {     return template.select(Student.class).all(); } public Mono&lt;Void&gt; delete(Student student) {     return template.delete(student).then(); } <\/code><\/pre>\n<h4>2.2 \u0414\u0420\u0423\u0413\u0418\u0415 \u041e\u0421\u041e\u0411\u0415\u041d\u041d\u041e\u0421\u0422\u0418<\/h4>\n<p><strong>2.2.1 \u041e\u041f\u0422\u0418\u041c\u0418\u0421\u0422\u0418\u0427\u0415\u0421\u041a\u0410\u042f \u0411\u041b\u041e\u041a\u0418\u0420\u041e\u0412\u041a\u0410<\/strong><\/p>\n<p>\u041f\u043e\u0434\u043e\u0431\u043d\u043e JPA, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c&nbsp;\u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e <code>@Version <\/code>\u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u043e\u043b\u044f, \u0447\u0442\u043e\u0431\u044b \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u0441\u0442\u0440\u043e\u043a\u0430\u043c \u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 &#8212; \u0435\u0441\u043b\u0438 \u0432\u0435\u0440\u0441\u0438\u044f \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 OptimisticLockingFailureException.<\/p>\n<p><strong>2.2.2 \u0422\u0420\u0410\u041d\u0417\u0410\u041a\u0426\u0418\u0418<\/strong><\/p>\n<p>Spring \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f\u043c\u0438 \u0447\u0435\u0440\u0435\u0437&nbsp;SPI&nbsp;<a href=\"https:\/\/docs.spring.io\/spring-framework\/docs\/current\/javadoc-api\/org\/springframework\/transaction\/ReactiveTransactionManager.html\" rel=\"noopener noreferrer nofollow\"><u>ReactiveTransactionManager<\/u><\/a>.&nbsp;\u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 <code>@Transactional <\/code>\u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043d\u043e\u0441\u0438\u0442\u044c \u043d\u0430 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u0430\u0445 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0442\u0438\u043f\u043e\u0432 Publisher \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f\u043c\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u043e \u0441&nbsp;\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c&nbsp;<a href=\"https:\/\/docs.spring.io\/spring-framework\/docs\/current\/javadoc-api\/org\/springframework\/transaction\/reactive\/TransactionalOperator.html\" rel=\"noopener noreferrer nofollow\"><u>TransactionalOperator<\/u><\/a>.<\/p>\n<p><strong>2.2.3 \u0420\u0415\u0410\u041a\u0422\u0418\u0412\u041d\u042b\u0415 \u0411\u0418\u0411\u041b\u0418\u041e\u0422\u0415\u041a\u0418<\/strong><\/p>\n<p>\u041a\u0430\u043a \u0438 WebFlux, Spring Data R2DBC \u0442\u0440\u0435\u0431\u0443\u0435\u0442 Project Reactor \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u043d\u043e \u043e\u043d \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c\u0438, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u043c\u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e Reactive Streams.&nbsp;\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u044f RxJava2 \u0438 RxJava3 (\u0441\u043c.&nbsp;<a href=\"https:\/\/docs.spring.io\/spring-data\/commons\/docs\/current\/api\/org\/springframework\/data\/repository\/reactive\/package-summary.html\" rel=\"noopener noreferrer nofollow\"><u>\u043e\u0431\u0437\u043e\u0440 \u043f\u0430\u043a\u0435\u0442\u0430<\/u><\/a>).<\/p>\n<p><strong>2.2.4 \u041f\u0423\u041b \u0421\u041e\u0415\u0414\u0418\u041d\u0415\u041d\u0418\u0419<\/strong><\/p>\n<p>\u0414\u043b\u044f \u043f\u0443\u043b\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c r2dbc-pool.&nbsp;\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0447\u0438\u0442\u0430\u0439\u0442\u0435&nbsp;<a href=\"https:\/\/github.com\/r2dbc\/r2dbc-pool\" rel=\"noopener noreferrer nofollow\"><u>\u0437\u0434\u0435\u0441\u044c<\/u><\/a>.<\/p>\n<h3>3. \u0413\u041e\u0422\u041e\u0412\u041d\u041e\u0421\u0422\u042c \u0414\u041b\u042f \u041f\u0420\u041e\u0414\u0410\u041a\u0428\u041d<\/h3>\n<p>R2DBC &#8212; \u0432\u0441\u0435 \u0435\u0449\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u043e\u0432\u0430\u044f \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f.&nbsp;\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0440\u0435\u043b\u0438\u0437\u0430 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442:<\/p>\n<ul>\n<li>\n<p>\u0421\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f R2DBC: 0.8.5<\/p>\n<\/li>\n<li>\n<p>Spring Data R2DBC: 1.3.1<\/p>\n<\/li>\n<li>\n<p>r2dbc-postgresql: 0.8.8<\/p>\n<\/li>\n<li>\n<p>r2dbc-pool: 0.8.7<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u0431 \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u043f\u0443\u043b\u0430 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0432\u0430\u0448\u0438\u043c\u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c\u0438.&nbsp;\u0415\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u0440\u0435\u0448\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043c\u0435\u0448\u0430\u0442\u044c \u0432\u0430\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0448\u0430\u0433 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e\u0442\u0441\u044f.<\/p>\n<h3>4. \u041f\u041e\u0414\u0412\u041e\u0414\u042f \u0418\u0422\u041e\u0413\u2026<\/h3>\n<p>\u042d\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u0431\u043b\u043e\u0433\u0435 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u043e, \u043a\u0430\u043a Spring Data R2DBC \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 WebFlux.&nbsp;\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u0434\u043e\u0448\u043b\u0438 \u043a \u043a\u043e\u043d\u0446\u0443 \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u043e \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438.<\/p>\n<p>\u0415\u0449\u0435 \u043e\u0434\u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u0442\u0438\u0432\u0430, \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u043e\u0438\u0442 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c, &#8212; \u044d\u0442\u043e&nbsp;<a href=\"https:\/\/wiki.openjdk.java.net\/display\/loom\/Main\" rel=\"noopener noreferrer nofollow\"><u>Project Loom<\/u><\/a>.&nbsp;\u042d\u0442\u043e \u043f\u0440\u043e\u0435\u043a\u0442 OpenJDK, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u0430\u043b \u0435\u0449\u0435 \u0432 2017 \u0433\u043e\u0434\u0443 \u0438 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u043d\u0430 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u043e\u0431\u043b\u0435\u0433\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c\u0430, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f \u043f\u043e\u0442\u043e\u043a\u043e\u0432 Java, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043f\u043e\u0442\u043e\u043a\u0430\u043c \u041e\u0421.&nbsp;\u0422\u0430\u043a\u043e\u0439 \u0442\u0438\u043f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0434\u0435\u0448\u0435\u0432\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0438 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>\u041a\u0430\u043a \u0432\u044b, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u043c\u043d\u0438\u0442\u0435 \u0438\u0437 <a href=\"https:\/\/habr.com\/ru\/post\/565004\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u0431\u043b\u043e\u0433\u0435,<\/a>&nbsp;\u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c\u0438 \u0444\u0430\u043a\u0442\u043e\u0440\u0430\u043c\u0438, \u043b\u0435\u0436\u0430\u0449\u0438\u043c\u0438 \u0432 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<\/p>\n<ul>\n<li>\n<p>\u043e\u0442\u0445\u043e\u0434 \u043e\u0442 \u043f\u043e\u0442\u043e\u043a\u0430 \u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043f\u0440\u0438 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430<\/p>\n<\/li>\n<li>\n<p>\u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u00ab\u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u00bb, \u0434\u0430\u0432\u0430\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440\u0443, \u0441 \u043a\u0430\u043a\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439 \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c\u0441\u044f<\/p>\n<\/li>\n<\/ul>\n<p>Project Loom \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e\u043e\u0431\u0435\u0449\u0430\u044e\u0449\u0438\u043c, \u043a\u043e\u0433\u0434\u0430 \u0434\u0435\u043b\u043e \u0434\u043e\u0445\u043e\u0434\u0438\u0442 \u0434\u043e \u043f\u043e\u043c\u043e\u0449\u0438 \u0441 \u043f\u0435\u0440\u0432\u044b\u043c\u0438 \u0434\u0432\u0443\u043c\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0432 \u044d\u0442\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435 &#8212; \u0442\u043e\u0433\u0434\u0430 \u043e\u0431 \u044d\u0442\u043e\u043c \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u0442\u0441\u044f \u0441\u0430\u043c\u0430 JVM \u0431\u0435\u0437 \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b.<\/p>\n<p>\u0415\u0449\u0435 \u043d\u0435 \u0440\u0435\u0448\u0435\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u0432\u043d\u0435\u0441\u0435\u043d\u044b \u0432 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u043f\u0443\u0441\u043a Java, \u043d\u043e \u0434\u0432\u043e\u0438\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0440\u0430\u043d\u043d\u0435\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430&nbsp;<a href=\"https:\/\/jdk.java.net\/loom\/\" rel=\"noopener noreferrer nofollow\"><u>\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/u><\/a>.<\/p>\n<p><strong>\u0421\u0421\u042b\u041b\u041a\u0418<\/strong><\/p>\n<p><a href=\"https:\/\/r2dbc.io\/\" rel=\"noopener noreferrer nofollow\"><u>R2DBC<\/u><\/a><\/p>\n<p><a href=\"https:\/\/docs.spring.io\/spring-data\/r2dbc\/docs\/current\/reference\/html\/#reference\" rel=\"noopener noreferrer nofollow\"><u>Spring Data R2DBC Reference Documentation<\/u><\/a><\/p>\n<p><a href=\"https:\/\/github.com\/pgjdbc\/r2dbc-postgresql\" rel=\"noopener noreferrer nofollow\"><u>r2dbc-postgresql<\/u><\/a><\/p>\n<p><a href=\"https:\/\/github.com\/r2dbc\/r2dbc-pool\" rel=\"noopener noreferrer nofollow\"><u>r2dbc-pool<\/u><\/a><\/p>\n<p><a href=\"https:\/\/wiki.openjdk.java.net\/display\/loom\/Main\" rel=\"noopener noreferrer nofollow\"><u>Project Loom<\/u><\/a><\/p>\n<p><a href=\"https:\/\/blogs.oracle.com\/javamagazine\/going-inside-javas-project-loom-and-virtual-threads\" rel=\"noopener noreferrer nofollow\"><u>Going inside Java\u2019s Project Loom and virtual threads<\/u><\/a><\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/565060\/\"> https:\/\/habr.com\/ru\/post\/565060\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u042d\u0442\u043e \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0430\u044f \u0447\u0430\u0441\u0442\u044c <a href=\"https:\/\/habr.com\/ru\/post\/565000\/\" rel=\"noopener noreferrer nofollow\"><u>\u0441\u0435\u0440\u0438\u0438 \u0437\u0430\u043c\u0435\u0442\u043e\u043a \u043e \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438<\/u><\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 R2DBC \u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u043e, \u043a\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Spring Data R2DBC \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<h3>1. \u0427\u0422\u041e \u0422\u0410\u041a\u041e\u0415 R2DBC?<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0435\u0449\u0435 \u043d\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438, \u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0432\u0430\u043c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/habr.com\/ru\/post\/565004\/\" rel=\"noopener noreferrer nofollow\"><u>\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/u><\/a>, \u0432&nbsp;\u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u043e\u0442\u0438\u0432\u0430\u0446\u0438\u044f, \u043b\u0435\u0436\u0430\u0449\u0430\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u0435 \u044d\u0442\u043e\u0439 \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>\u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, JDBC \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0439 API.<\/p>\n<p>R2DBC \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442&nbsp;<code>Reactive Relational Database Connectivity <\/code>\u0438 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 SQL \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e API.&nbsp;\u041e\u043d \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 Reactive Streams \u0438 \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 SPI (Service Provider Interface   &#8212; \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0430 \u0443\u0441\u043b\u0443\u0433) \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0430\u0432\u0442\u043e\u0440\u043e\u0432 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0435 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u043a\u043e\u0434\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u0434\u043b\u044f Oracle, Microsoft SQL Server, MySQL, PostgreSQL, H2, MariaDB \u0438 Google Cloud Spanner.<\/p>\n<h3>2. SPRING DATA R2DBC<\/h3>\n<p>Spring Data \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442 R2DBC &#8212; Spring Data R2DBC.<\/p>\n<p>\u042d\u0442\u043e \u043d\u0435 \u043f\u043e\u043b\u043d\u044b\u0439 ORM, \u043a\u0430\u043a JPA &#8212; \u043e\u043d \u043d\u0435 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0442\u0430\u043a\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043a\u0430\u043a \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u043b\u0438 \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u0430\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430.&nbsp;\u041d\u043e \u043e\u043d \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044e \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 StudentController \u0438\u0437 <a href=\"https:\/\/habr.com\/ru\/post\/565056\/\" rel=\"noopener noreferrer nofollow\"><u>\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0438 \u043e WebFlux<\/u><\/a>:<\/p>\n<pre><code class=\"java\">@RestController @RequestMapping(\"\/students\") public class StudentController {      @Autowired     private StudentService studentService;       public StudentController() {     }      @GetMapping(\"\/{id}\")     public Mono&lt;ResponseEntity&lt;Student&gt;&gt; getStudent(@PathVariable long id) {         return studentService.findStudentById(id)                 .map(ResponseEntity::ok)                 .defaultIfEmpty(ResponseEntity.notFound().build());     }      @GetMapping     public Flux&lt;Student&gt; listStudents(@RequestParam(name = \"name\", required = false) String name) {         return studentService.findStudentsByName(name);     }      @PostMapping     public Mono&lt;Student&gt; addNewStudent(@RequestBody Student student) {         return studentService.addNewStudent(student);     }      @PutMapping(\"\/{id}\")     public Mono&lt;ResponseEntity&lt;Student&gt;&gt; updateStudent(@PathVariable long id, @RequestBody Student student) {         return studentService.updateStudent(id, student)                 .map(ResponseEntity::ok)                 .defaultIfEmpty(ResponseEntity.notFound().build());     }      @DeleteMapping(\"\/{id}\")     public Mono&lt;ResponseEntity&lt;Void&gt;&gt; deleteStudent(@PathVariable long id) {         return studentService.findStudentById(id)                 .flatMap(s -&gt;                         studentService.deleteStudent(s)                                 .then(Mono.just(new ResponseEntity&lt;Void&gt;(HttpStatus.OK)))                 )                 .defaultIfEmpty(new ResponseEntity&lt;&gt;(HttpStatus.NOT_FOUND));     } }<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0430\u0434 \u0443\u0447\u0430\u0449\u0438\u043c\u0438\u0441\u044f.&nbsp;\u041c\u044b \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 StudentService \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439.&nbsp;\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043b\u0435\u0436\u0430\u0449\u0443\u044e \u0432 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 REST, \u0438 \u0442\u043e, \u043a\u0430\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e R2DBC.<\/p>\n<h4>2.1 \u041f\u0420\u0418\u041c\u0415\u0420 \u0420\u0415\u0410\u041b\u0418\u0417\u0410\u0426\u0418\u0418<\/h4>\n<p><strong>2.1.1 \u0417\u0410\u0412\u0418\u0421\u0418\u041c\u041e\u0421\u0422\u0418<\/strong><\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u0430\u0440\u0443 \u043d\u043e\u0432\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439:<\/p>\n<pre><code class=\"xml\">&lt;dependencies&gt;         &lt;dependency&gt;             &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;             &lt;artifactId&gt;spring-boot-starter-data-r2dbc&lt;\/artifactId&gt;         &lt;\/dependency&gt;          &lt;dependency&gt;             &lt;groupId&gt;io.r2dbc&lt;\/groupId&gt;             &lt;artifactId&gt;r2dbc-postgresql&lt;\/artifactId&gt;             &lt;scope&gt;runtime&lt;\/scope&gt;         &lt;\/dependency&gt;         ... &lt;\/dependencies&gt; <\/code><\/pre>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c spring-boot-starter-data-r2dbc, \u0447\u0442\u043e\u0431\u044b \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c spring-data-r2dbc.&nbsp;\u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 postgresql, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c r2dbc-postgresql, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 r2dbc.<\/p>\n<p><strong>2.1.2 \u041a\u041e\u041d\u0424\u0418\u0413\u0423\u0420\u0410\u0426\u0418\u042f \u0411\u0410\u0417\u042b \u0414\u0410\u041d\u041d\u042b\u0425<\/strong><\/p>\n<p>\u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043b\u0438\u0431\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u0435\u0442\u0430\u043b\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u043d\u0430\u0448\u0435\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 application.properties:<\/p>\n<pre><code class=\"bash\">spring.r2dbc.url=r2dbc:postgresql:\/\/localhost\/studentdb spring.r2dbc.username=user spring.r2dbc.password=secret<\/code><\/pre>\n<p>\u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 Java:<\/p>\n<pre><code class=\"java\">import io.r2dbc.spi.ConnectionFactories; import io.r2dbc.spi.ConnectionFactory; import io.r2dbc.spi.ConnectionFactoryOptions; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration;  import static io.r2dbc.spi.ConnectionFactoryOptions.*;  @Configuration public class R2DBCConfig {      @Bean     public ConnectionFactory connectionFactory() {         return ConnectionFactories.get(                 ConnectionFactoryOptions.builder()                         .option(DRIVER, \"postgresql\")                         .option(HOST, \"localhost\")                         .option(USER, \"user\")                         .option(PASSWORD, \"secret\")                         .option(DATABASE, \"studentdb\")                         .build());     } }<\/code><\/pre>\n<p><strong>2.1.3 STUDENTSERVICE<\/strong><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 StudentService, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 StudentController:<\/p>\n<pre><code class=\"java\">@Service public class StudentService {      @Autowired     private StudentRepository studentRepository;      public StudentService() {     }      public Flux&lt;Student&gt; findStudentsByName(String name) {         return (name != null) ? studentRepository.findByName(name) : studentRepository.findAll();     }      public Mono&lt;Student&gt; findStudentById(long id) {         return studentRepository.findById(id);     }      public Mono&lt;Student&gt; addNewStudent(Student student) {         return studentRepository.save(student);     }      public Mono&lt;Student&gt; updateStudent(long id, Student student) {         return studentRepository.findById(id)                 .flatMap(s -&gt; {                     student.setId(s.getId());                     return studentRepository.save(student);                 });      }      public Mono&lt;Void&gt; deleteStudent(Student student) {         return studentRepository.delete(student);     }  }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 StudentRepository \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u0434 \u0443\u0447\u0430\u0449\u0438\u043c\u0438\u0441\u044f.&nbsp;\u0418\u0442\u0430\u043a, \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439.  <\/p>\n<p><strong>2.1.4 STUDENTREPOSITORY<\/strong><\/p>\n<p>StudentRepository &#8212; \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f&nbsp;<a href=\"https:\/\/docs.spring.io\/spring-data\/commons\/docs\/current\/api\/org\/springframework\/data\/repository\/reactive\/ReactiveCrudRepository.html\" rel=\"noopener noreferrer nofollow\"><u>ReactiveCrudRepository<\/u><\/a>.&nbsp;\u042d\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0438\u0437 Spring Data R2DBC \u0434\u043b\u044f \u043e\u0431\u0449\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 CRUD \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u0438\u043f\u043e\u0432 Project Reactor.&nbsp;\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 ReactiveCrudRepository \u0443\u0436\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432 StudentService (findAll, findById, save \u0438 delete), \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"java\">public interface StudentRepository extends ReactiveCrudRepository&lt;Student, Long&gt; { &lt;span class=\"token keyword\" style=\"box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; color: rgb(0, 119, 170);\"&gt;public&lt;\/span&gt; Flux&lt;span class=\"token operator\" style=\"box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; color: rgb(166, 127, 89); background: rgba(255, 255, 255, 0.5);\"&gt;&amp;lt;&lt;\/span&gt;Student&lt;span class=\"token operator\" style=\"box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; color: rgb(166, 127, 89); background: rgba(255, 255, 255, 0.5);\"&gt;&amp;gt;&lt;\/span&gt; &lt;span class=\"token function\" style=\"box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline;\"&gt;findByName&lt;span class=\"token punctuation\" style=\"box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; color: rgb(153, 153, 153);\"&gt;(&lt;\/span&gt;&lt;\/span&gt;String name&lt;span class=\"token punctuation\" style=\"box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; color: rgb(153, 153, 153);\"&gt;)&lt;\/span&gt;&lt;span class=\"token punctuation\" style=\"box-sizing: border-box; margin: 0px; padding: 0px; border: 0px; font: inherit; vertical-align: baseline; color: rgb(153, 153, 153);\"&gt;;&lt;\/span&gt;  }<\/code><\/pre>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e @Query \u043a \u043c\u0435\u0442\u043e\u0434\u0443 \u0438 \u0443\u043a\u0430\u0437\u0430\u0432 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 sql.<\/p>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e ReactiveCrudRepository, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435&nbsp;<a href=\"https:\/\/docs.spring.io\/spring-data\/commons\/docs\/current\/api\/org\/springframework\/data\/repository\/reactive\/ReactiveSortingRepository.html\" rel=\"noopener noreferrer nofollow\"><u>ReactiveSortingRepository,<\/u><\/a>&nbsp;\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<p><strong>2.1.5 STUDENT<\/strong><\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e Student:  <\/p>\n<pre><code class=\"java\">import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.annotation.Id; import org.springframework.data.relational.core.mapping.Table;  @Data @AllArgsConstructor @NoArgsConstructor @Table public class Student {      @Id     private Long id;     private String name;     private String address;  }<\/code><\/pre>\n<p>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0439:<\/p>\n<ul>\n<li>\n<p>\u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0430\u043d\u043d\u043e\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0435\u0439 Spring Data @Id.<\/p>\n<\/li>\n<li>\n<p>\u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 @Table \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b, \u043d\u043e \u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043a\u0430\u043d\u0435\u0440\u0443 \u043f\u0443\u0442\u0438 \u043a \u043a\u043b\u0430\u0441\u0441\u0430\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0438 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0434\u043b\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445.&nbsp;\u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u0435 \u0435\u0433\u043e, \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>Lombok \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u0442\u044c \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0432&nbsp;<a href=\"https:\/\/docs.spring.io\/spring-data\/r2dbc\/docs\/current\/reference\/html\/#mapping.general-recommendations\" rel=\"noopener noreferrer nofollow\"><u>\u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/u><\/a>.<\/p>\n<\/li>\n<\/ul>\n<p><strong>2.1.6 \u0414\u0420\u0423\u0413\u0418\u0415 \u0412\u0410\u0420\u0418\u0410\u041d\u0422\u042b \u0417\u0410\u041f\u0420\u041e\u0421\u041e\u0412<\/strong><\/p>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e SQL \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f&nbsp;<a href=\"https:\/\/docs.spring.io\/spring-framework\/docs\/current\/javadoc-api\/org\/springframework\/r2dbc\/core\/DatabaseClient.html\" rel=\"noopener noreferrer nofollow\"><u>DatabaseClient<\/u><\/a>.<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435\u0445 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432:<\/p>\n<pre><code class=\"java\"> public Flux&lt;Student&gt; findAll() {         DatabaseClient client = DatabaseClient.create(connectionFactory);         return client.sql(\"select * from student\")                 .map(row -&gt; new Student(row.get(\"id\", Long.class),                         row.get(\"name\", String.class),                    <\/code><\/pre>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-325757","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/325757","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=325757"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/325757\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=325757"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=325757"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=325757"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}