官术网_书友最值得收藏!

  • Spring 5.0 Projects
  • Nilang Patel
  • 441字
  • 2021-07-02 12:35:08

Spring WebFlux application

We will create a sample web application with the WebFlux framework. The application will simply access existing student information from a data store. Instead of making a fully fledged application, we will focus more on how to access data in a reactive manner with the WebFlux framework.

We will use Spring Boot to kickstart the development. For those who are new to Spring Boot, it is a tool and part of Spring Horizon, which is designed to speed up and simplify the bootstrapping and development of new Spring-based applications.

You might have come across bulky XML and other configurations repeatedly in Spring projects. The Spring team was well aware of this and has finally developed a tool called Spring Boot, aimed at freeing the developer from providing a boilerplate configuration, which is not only tedious but time consuming.

We will create a sample web application using MongoDB as a data store. While working with Reactive Programming, it is recommended to use non-blocking and reactive capable datastores, like MongoDB, Couchbase, Cassandra, and so on. We will use a tool called Spring Tool Suite (STS), which is an Eclipse-based IDE. It provides support for creating Spring Boot-based applications. Download it from: https://spring.io/tools3/sts/all and install it in your local machine. 

The STS link given here is version 3.x. At the time of writing, the current version of STS is 4.x. All the codes created in this book are with STS 3.x so the link given is version 3.x. However, you can download the latest version of STS and play with the code without any problems. 

Once downloaded, open it, select the File | New | Spring Starter Project menu and fill the form as follows:

Click on the Next button, and you will be asked to define the dependencies. Choose the following dependencies. You can use the textbox, Available to search for a particular dependency:

  • Web: Used to add Spring MVC specific dependencies.
  • Reactive Web: To add WebFlux specific dependencies.
  • DevTools: Helpful for development as it will auto-refresh the changes in the embedded container to see the changes quickly. 
  • Reactive MongoDB: Spring Data dependency for MongoDB that works in a reactive paradigm. Make sure you don't select MongoDB, which is a dependency to work with MongoDB in the non-reactive model.

Click on Finish, and you will see a project is created in the Package Explorer (or Project Explorer) section of STS. Once the project is created, we will perform the following steps.

主站蜘蛛池模板: 南充市| 江油市| 德令哈市| 宁强县| 辽阳县| 盐源县| 哈密市| 桦甸市| 富宁县| 贡觉县| 武功县| 济宁市| 清河县| 社旗县| 桐城市| 绥中县| 慈溪市| 江安县| 二手房| 武功县| 福州市| 逊克县| 栖霞市| 陆丰市| 泰顺县| 张家港市| 清流县| 泸水县| 武宁县| 澄城县| 奉新县| 大足县| 库伦旗| 专栏| 临城县| 漯河市| 彰武县| 博白县| 柘荣县| 彭阳县| 绥中县|