Asynchronous calls in Spring applications
Table of Contents
Making asynchronous calls in Spring Boot
See https://spring.io/guides/gs/async-method
How do you enable asynchronous method calls in Spring Boot? You want to start with @EnableAsync annotation on your Application class under the @SpringBootApplication annotation.
With that enabled, you can use @Async annotation in your services that return CompletableFuture<>. Because you have @EnableAsync , the @Async methods will be run in a background thread pool.
If you make a good use of the asynchronous execution, you will avoid many unnecessary dips in performance, making your service as fast and responsive as it is possible.