Use Spring Boot 2.0 + WebFlux to implement RESTful API functions, webfluxrestful

Source: Internet
Author: User

Use Spring Boot 2.0 + WebFlux to implement RESTful API functions, webfluxrestful

Overview

What is Spring WebFlux? It is an asynchronous, non-blocking Web development framework that supports the Back-pressure mechanism. To learn more about Spring WebFlux, you must first understandReactive StreamAnother programming posture is relative to imperative programming.

WebFlux supports two programming styles (trend)

  • The annotation-based posture of @ Controller is the same as that of Sring MVC.
  • Functional programming style based on Java 8 Lambda

Note: The above are just two programming postures, and "Mandarin and Chongqing dialect are both Chinese" is a truth. our company is also from other places. We speak Mandarin to him and celebrate our local colleagues. this is called polymorphism.

Create a project

Create a Project Skeleton Through A http://start.spring.io.

 

For manual configuration, you need to add the Spring Milestone (Milestone) Repository:

<repositories>  <repository>    <id>spring-snapshots</id>    <name>Spring Snapshots</name>    <url>https://repo.spring.io/snapshot</url>    <snapshots>      <enabled>true</enabled>    </snapshots>  </repository>  <repository>    <id>spring-milestones</id>    <name>Spring Milestones</name>    <url>https://repo.spring.io/milestone</url>    <snapshots>      <enabled>false</enabled>    </snapshots>  </repository></repositories><pluginRepositories>  <pluginRepository>    <id>spring-snapshots</id>    <name>Spring Snapshots</name>    <url>https://repo.spring.io/snapshot</url>    <snapshots>      <enabled>true</enabled>    </snapshots>  </pluginRepository>  <pluginRepository>    <id>spring-milestones</id>    <name>Spring Milestones</name>    <url>https://repo.spring.io/milestone</url>    <snapshots>      <enabled>false</enabled>    </snapshots>  </pluginRepository></pluginRepositories>

Test

List all users

 

Create user

 

Obtain a single user

 

Modify

 

Delete

 

Source code

Demo-spring-boot-webflux-annotaion

Summary

The above section describes how to use Spring Boot 2.0 + WebFlux to implement the RESTful API function. I hope it will help you. If you have any questions, please leave a message, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.