How I got my SpringBoot application to execute a service in multiple threads Enabled SpringBoot application run Async tasks Defined a service method which can be invoked asynchronously and returns CompletableFuture object as required by Spring Let Spring manage service component instance Though not required, configured TaskExecutor Spring could use Enable SpringBoot application to run tasks asynchronously To be able to execute tasks using multiple threads asynchronously SpringBoot application must be annotated with @EnableAsync . I defined this annotation right after @SpringBootApplication . @SpringBootApplication @EnableAsync public class NosqlApplication implements CommandLineRunner { Logger logger = LoggerFactory. getLogger (NosqlApplication. class ) ; Aync service method returning CompletableFuture object Spring could invoke tasks synchronously and asynchronously. To be able to invoke tasks asynchronously (and let main thread do other things) I annotated the servic...
My notes along the way as I continue to explore different technologies