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!