The problem to solve is how to blend the various programming styles (functional programming in this case) available in Java 8 to meet an application's need. Disclaimer : All the paragraphs/codes are direct copy from the book . This note captures the key points in the book I found particularly useful to myself. Thank the author for creating such a good book on the functional programming in Java. Functional Programming Concept First-class and high-order functions are associated with functional programming. A first-class function is a computer science term. It refers to functions that can be used anywhere a first-class entity can be used. A first-class entity includes elements such as numbers and strings. They can be used as an argument to a function, returned from a function, or assigned to a variable. High-order functions depend upon the existence of first-class functions. They are functions that either: Take a function as an argument Return a function Java 8 ha...
Starting from Spring 5, AsyncRestTemplate is deprecated in favour of WebClient from spring-webflux. One good thing is that you don’t have to use reactive async WebFlux in order to use WebClient. Instead, you can still use WebClient in a synchronous blocking way in Spring Web MVC so your existing projects can continue to work. When converting one of my existing applications from AsyncRestTemplate to WebClient, I found there wasn’t sufficient documentation or examples to do a quick replacement. After a bit of searching and learning by trial and error, here are the code snippets I came out eventually. Here is the code gist Reference : https://docs.spring.io/spring/docs/5.0.0.RELEASE/spring-framework-reference/web-reactive.html#webflux-client https://www.callicoder.com/spring-5-reactive-webclient-webtestclient-examples/ Create WebClient Requirements Create one WebClient bean for each service that requires specific configurations. Config timeout, such as c...