Objective
With spring Boot2.0 officially released, Spring Webflux formally came to the spring boot big family. I am interested in this because spring Webflux can achieve higher concurrency with fewer threads and use less hardware resources to implement extensions. At the same time Angular6 also released, also want to try their own angular foundation, then based on angular and spring Webflux do a simple Gift management system demo. As for angular and spring boot integration, you can refer to the blog angular and spring boot to do a project
Responsive programming
Responsive programming is a programming paradigm for data flow and change propagation. This means that static or dynamic data flows can be easily expressed in a programming language, and the associated calculation model automatically propagates the changed values through the data stream. An individual's popular understanding is that the act of generating data is placed within a data stream, where the data in the stream is transformed appropriately by some operators, and the data in that data stream is finally fetched and processed. My earliest contact-responsive programming was to learn Angular2 when learning about RXJS, which is the implementation version of Reactivexz on JS, and its Java version is Rxjava.
Learning Advice
- Since spring Webflux is based on the reactor library, it is recommended to first learn about reactor and understand the concept of responsive programming, which distinguishes between mono and flux. Its website link is http://projectreactor.io.
- If you can spare force, you can consider learning RxJava2.
- Use event-based programming thinking as much as possible, and write less synchronous code.
The view of Spring Webflux
- If spring MVC has been able to meet the requirements in real-world development, do not use spring Webflux unless you are simply wrapping the service's return interface into mono or flux in the controller layer.
- If you use spring Webflux, try to use Java annotations as much as possible, especially when request parameters are complicated, the functional programming model of a lambda expression based on Java 8 is really bad!!!
Code sharing
Code has been placed on GitHub and the code cloud, I hope you can more guidance.
Do a little demo based on angular and spring Webflux