{"id":761,"date":"2022-08-24T09:38:08","date_gmt":"2023-12-08T07:59:29","guid":{"rendered":"https:\/\/www.silicloud.com\/blog\/uncategorized\/the-spring-async-annotation-enables-asynchronous-processing\/"},"modified":"2024-03-12T15:22:13","modified_gmt":"2024-03-12T15:22:13","slug":"the-spring-async-annotation-enables-asynchronous-processing","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/blog\/the-spring-async-annotation-enables-asynchronous-processing\/","title":{"rendered":"The Spring @Async Annotation enables asynchronous processing."},"content":{"rendered":"<p>The @Async annotation in Spring enables the creation of asynchronous methods. In this tutorial on the Spring framework, we will delve into the usage of @Async. When we apply the @Async annotation to a method of a bean, Spring will execute it in a separate thread, allowing the caller of the method to proceed without waiting for its completion. For this example, we will define a custom Service and utilize Spring Boot 2. Let&#8217;s begin!<\/p>\n<h2>Example of Spring&#8217;s @Async implementation for asynchronous programming.<\/h2>\n<p>To demonstrate, we will utilize Maven to generate a sample project. In order to create the project, simply run the given command in the desired workspace directory.<\/p>\n<pre class=\"post-pre\"><code>mvn archetype:generate -DgroupId=com.scdev.asynchmethods -DartifactId=JD-SpringBoot-AsyncMethods -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false\r\n<\/code><\/pre>\n<p>When running Maven for the first time, it may take a few seconds to complete the generate command as Maven needs to download the necessary plugins and artifacts for the generation task. The following image shows how project creation appears:Creating a project with MavenAfter creating the project, you can open it in your preferred <a href=\"https:\/\/en.wikipedia.org\/wiki\/Integrated_development_environment\">IDE<\/a>. The next step is to add the appropriate Maven Dependencies to the project. The pom.xml file with the relevant dependencies can be found below:<\/p>\n<pre class=\"post-pre\"><code>&lt;parent&gt;\r\n    &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n    &lt;artifactId&gt;spring-boot-starter-parent&lt;\/artifactId&gt;\r\n    &lt;version&gt;2.0.1.RELEASE&lt;\/version&gt;\r\n    &lt;relativePath\/&gt; &lt;!-- lookup parent from repository --&gt;\r\n&lt;\/parent&gt;\r\n\r\n&lt;dependencies&gt;\r\n\r\n    &lt;dependency&gt;\r\n        &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n        &lt;artifactId&gt;spring-boot-starter-web&lt;\/artifactId&gt;\r\n    &lt;\/dependency&gt;\r\n\r\n    &lt;dependency&gt;\r\n        &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n        &lt;artifactId&gt;spring-boot-starter-test&lt;\/artifactId&gt;\r\n        &lt;scope&gt;test&lt;\/scope&gt;\r\n    &lt;\/dependency&gt;\r\n\r\n&lt;\/dependencies&gt;\r\n\r\n&lt;build&gt;\r\n    &lt;plugins&gt;\r\n        &lt;plugin&gt;\r\n            &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n            &lt;artifactId&gt;spring-boot-maven-plugin&lt;\/artifactId&gt;\r\n        &lt;\/plugin&gt;\r\n    &lt;\/plugins&gt;\r\n&lt;\/build&gt;\r\n<\/code><\/pre>\n<p>In order to comprehend all the JARs incorporated into the project after adding this dependency, we can execute a basic Maven command that displays a comprehensive Dependency Tree. The following command can be utilized:<\/p>\n<pre class=\"post-pre\"><code>mvn dependency:tree\r\n<\/code><\/pre>\n<p>If we execute this command, it will display the Dependency Tree mentioned below.<\/p>\n<h2>Allowing the use of asynchronous support.<\/h2>\n<p>Enabling Async support is also just a matter of a single annotation. In addition to enabling Async execution, we will also utilize an Executor to define Thread limits. We will discuss this further once we start coding.<\/p>\n<pre class=\"post-pre\"><code>package com.scdev.asynchexample;\r\n\r\nimport org.springframework.boot.SpringApplication;\r\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\r\nimport org.springframework.context.annotation.Bean;\r\nimport org.springframework.scheduling.annotation.EnableAsync;\r\nimport org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;\r\n\r\nimport java.util.concurrent.Executor;\r\n\r\n@SpringBootApplication\r\n@EnableAsync\r\npublic class AsyncApp {\r\n    ...\r\n}\r\n<\/code><\/pre>\n<p>We utilized the @EnableAsync annotation to activate Spring&#8217;s capability to execute methods asynchronously in a separate thread pool. Additionally, we included the specified Executor.<\/p>\n<pre class=\"post-pre\"><code>@Bean\r\npublic Executor asyncExecutor() {\r\n    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();\r\n    executor.setCorePoolSize(2);\r\n    executor.setMaxPoolSize(2);\r\n    executor.setQueueCapacity(500);\r\n    executor.setThreadNamePrefix(\"JDAsync-\");\r\n    executor.initialize();\r\n    return executor;\r\n}\r\n<\/code><\/pre>\n<p>In this code, we specify that only a maximum of 2 threads can run at the same time and the queue size is limited to 500. Below is the entire class code with its import statements.<\/p>\n<pre class=\"post-pre\"><code>package com.scdev.asynchexample;\r\n\r\nimport org.springframework.boot.SpringApplication;\r\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\r\nimport org.springframework.context.annotation.Bean;\r\nimport org.springframework.scheduling.annotation.EnableAsync;\r\nimport org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;\r\n\r\nimport java.util.concurrent.Executor;\r\n\r\n@SpringBootApplication\r\n@EnableAsync\r\npublic class AsyncApp {\r\n\r\n    public static void main(String[] args) {\r\n        SpringApplication.run(AsyncApp.class, args).close();\r\n    }\r\n\r\n    @Bean\r\n    public Executor asyncExecutor() {\r\n        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();\r\n        executor.setCorePoolSize(2);\r\n        executor.setMaxPoolSize(2);\r\n        executor.setQueueCapacity(500);\r\n        executor.setThreadNamePrefix(\"JDAsync-\");\r\n        executor.initialize();\r\n        return executor;\r\n    }\r\n}\r\n<\/code><\/pre>\n<p>We will create a service that truly utilizes Thread executions.<\/p>\n<h2>Creating a prototype<\/h2>\n<p>We plan to utilize a publicly available Movie API that solely provides information about movies. Our objective is to create our own model for the API.<\/p>\n<pre class=\"post-pre\"><code>package com.scdev.asynchexample;\r\n\r\nimport com.fasterxml.jackson.annotation.JsonIgnoreProperties;\r\n\r\n@JsonIgnoreProperties(ignoreUnknown = true)\r\npublic class MovieModel {\r\n\r\n    private String title;\r\n    private String producer;\r\n\r\n    \/\/ standard getters and setters\r\n\r\n    @Override\r\n    public String toString() {\r\n        return String.format(\"MovieModel{title='%s', producer='%s'}\", title, producer);\r\n    }\r\n}\r\n<\/code><\/pre>\n<p>We have utilized @JsonIgnoreProperties to ensure that any additional attributes in the response can be safely disregarded by Spring.<\/p>\n<h2>Providing the service.<\/h2>\n<p>It is time for us to establish our Service that will make requests to the Movie API mentioned. We will utilize a basic RestTemplate to make a GET API call and fetch results asynchronously. Now, let&#8217;s examine the code snippet we employ.<\/p>\n<pre class=\"post-pre\"><code>package com.scdev.asynchexample;\r\n\r\nimport org.slf4j.Logger;\r\nimport org.slf4j.LoggerFactory;\r\nimport org.springframework.boot.web.client.RestTemplateBuilder;\r\nimport org.springframework.scheduling.annotation.Async;\r\nimport org.springframework.stereotype.Service;\r\nimport org.springframework.web.client.RestTemplate;\r\n\r\nimport java.util.concurrent.CompletableFuture;\r\n\r\n@Service\r\npublic class MovieService {\r\n\r\n    private static final Logger LOG = LoggerFactory.getLogger(MovieService.class);\r\n\r\n    private final RestTemplate restTemplate;\r\n\r\n    public MovieService(RestTemplateBuilder restTemplateBuilder) {\r\n        this.restTemplate = restTemplateBuilder.build();\r\n    }\r\n\r\n    @Async\r\n    public CompletableFuture lookForMovie(String movieId) throws InterruptedException {\r\n        LOG.info(\"Looking up Movie ID: {}\", movieId);\r\n        String url = String.format(\"https:\/\/ghibliapi.herokuapp.com\/films\/%s\", movieId);\r\n        MovieModel results = restTemplate.getForObject(url, MovieModel.class);\r\n        \/\/ Artificial delay of 1s for demonstration purposes\r\n        Thread.sleep(1000L);\r\n        return CompletableFuture.completedFuture(results);\r\n    }\r\n}\r\n<\/code><\/pre>\n<p>This class is marked as a @Service, allowing it to be scanned by Spring Component Scan. The return type of the lookForMovie method is CompletableFuture, as is necessary for any asynchronous service. To demonstrate the potential timing differences of the API, we have included a 2-second delay.<\/p>\n<h2>Creating a Command Line Runner<\/h2>\n<p>We will execute our app by utilizing a CommandLineRunner, which is the simplest method to test our application. A CommandLineRunner executes immediately after all the beans in the application have been initialized. Now, let&#8217;s examine the code for the CommandLineRunner.<\/p>\n<pre class=\"post-pre\"><code>package com.scdev.asynchexample;\r\n\r\nimport org.slf4j.Logger;\r\nimport org.slf4j.LoggerFactory;\r\nimport org.springframework.boot.CommandLineRunner;\r\nimport org.springframework.stereotype.Component;\r\n\r\nimport java.util.concurrent.CompletableFuture;\r\n\r\n@Component\r\npublic class ApplicationRunner implements CommandLineRunner {\r\n\r\n    private static final Logger LOG = LoggerFactory.getLogger(ApplicationRunner.class);\r\n\r\n    private final MovieService movieService;\r\n\r\n    public ApplicationRunner(MovieService movieService) {\r\n        this.movieService = movieService;\r\n    }\r\n\r\n\r\n    @Override\r\n    public void run(String... args) throws Exception {\r\n        \/\/ Start the clock\r\n        long start = System.currentTimeMillis();\r\n\r\n        \/\/ Kick of multiple, asynchronous lookups\r\n        CompletableFuture&lt;MovieModel&gt; page1 = movieService.lookForMovie(\"58611129-2dbc-4a81-a72f-77ddfc1b1b49\");\r\n        CompletableFuture&lt;MovieModel&gt; page2 = movieService.lookForMovie(\"2baf70d1-42bb-4437-b551-e5fed5a87abe\");\r\n        CompletableFuture&lt;MovieModel&gt; page3 = movieService.lookForMovie(\"4e236f34-b981-41c3-8c65-f8c9000b94e7\");\r\n\r\n        \/\/ Join all threads so that we can wait until all are done\r\n        CompletableFuture.allOf(page1, page2, page3).join();\r\n\r\n        \/\/ Print results, including elapsed time\r\n        LOG.info(\"Elapsed time: \" + (System.currentTimeMillis() - start));\r\n        LOG.info(\"--&gt; \" + page1.get());\r\n        LOG.info(\"--&gt; \" + page2.get());\r\n        LOG.info(\"--&gt; \" + page3.get());\r\n    }\r\n}\r\n<\/code><\/pre>\n<p>We recently utilized the RestTemplate to query the example API with a selection of randomly chosen Movie IDs. The application will now be executed to observe the resulting output.<\/p>\n<h2>Operating the software.<\/h2>\n<p>Once the application is executed, the output displayed will be as follows.<\/p>\n<pre class=\"post-pre\"><code>2018-04-13  INFO 17868 --- [JDAsync-1] c.j.a.MovieService  : Looking up Movie ID: 58611129-2dbc-4a81-a72f-77ddfc1b1b49\r\n2018-04-13 08:00:09.518  INFO 17868 --- [JDAsync-2] c.j.a.MovieService  : Looking up Movie ID: 2baf70d1-42bb-4437-b551-e5fed5a87abe\r\n2018-04-13 08:00:12.254  INFO 17868 --- [JDAsync-1] c.j.a.MovieService  : Looking up Movie ID: 4e236f34-b981-41c3-8c65-f8c9000b94e7\r\n2018-04-13 08:00:13.565  INFO 17868 --- [main] c.j.a.ApplicationRunner  : Elapsed time: 4056\r\n2018-04-13 08:00:13.565  INFO 17868 --- [main] c.j.a.ApplicationRunner  : --&gt; MovieModel{title='My Neighbor Totoro', producer='Hayao Miyazaki'}\r\n2018-04-13 08:00:13.565  INFO 17868 --- [main] c.j.a.ApplicationRunner  : --&gt; MovieModel{title='Castle in the Sky', producer='Isao Takahata'}\r\n2018-04-13 08:00:13.566  INFO 17868 --- [main] c.j.a.ApplicationRunner  : --&gt; MovieModel{title='Only Yesterday', producer='Toshio Suzuki'}\r\n<\/code><\/pre>\n<p>If you take a closer look, you will notice that only two threads were specifically created for execution within the app: JDAsync-1 and JDAsync-2.<\/p>\n<h2>In summary, that is the final outcome.<\/h2>\n<p>In this tutorial, we explored the utilization of Spring Boot 2&#8217;s asynchronous features in conjunction with Spring. For additional Spring-related articles, please click here.<\/p>\n<h2>Please fetch the Source Code.<\/h2>\n<p>Get the Spring Boot Async Example Project for download.<\/p>\n<p>&nbsp;<\/p>\n<p>More tutorials<\/p>\n<p><a class=\"LinkSuggestion__Link-sc-1gewdgc-4 cLBplk\" href=\"https:\/\/www.silicloud.com\/blog\/spring-component-annotation\/\" target=\"_blank\" rel=\"noopener\">Spring Component annotation<span class=\"sc-gswNZR eASTkv\">(Opens in a new browser tab)<\/span><\/a><\/p>\n<p><a class=\"LinkSuggestion__Link-sc-1gewdgc-4 cLBplk\" href=\"https:\/\/www.silicloud.com\/blog\/spring-mvc-controller\/\" target=\"_blank\" rel=\"noopener\">Spring MVC Controller<span class=\"sc-gswNZR eASTkv\">(Opens in a new browser tab)<\/span><\/a><\/p>\n<p><a class=\"LinkSuggestion__Link-sc-1gewdgc-4 cLBplk\" href=\"https:\/\/www.silicloud.com\/blog\/error-attempting-to-install-java-on-a-macbook\/\" target=\"_blank\" rel=\"noopener\">error Attempting to install Java on a MacBook.<span class=\"sc-gswNZR eASTkv\">(Opens in a new browser tab)<\/span><\/a><\/p>\n<p><a class=\"LinkSuggestion__Link-sc-1gewdgc-4 cLBplk\" href=\"https:\/\/www.silicloud.com\/blog\/the-spring-framework\/\" target=\"_blank\" rel=\"noopener\">The Spring Framework<span class=\"sc-gswNZR eASTkv\">(Opens in a new browser tab)<\/span><\/a><\/p>\n<p><a class=\"LinkSuggestion__Link-sc-1gewdgc-4 cLBplk\" href=\"https:\/\/www.silicloud.com\/blog\/spring-boot-cli\/\" target=\"_blank\" rel=\"noopener\">Spring Boot CLI<span class=\"sc-gswNZR eASTkv\">(Opens in a new browser tab)<\/span><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The @Async annotation in Spring enables the creation of asynchronous methods. In this tutorial on the Spring framework, we will delve into the usage of @Async. When we apply the @Async annotation to a method of a bean, Spring will execute it in a separate thread, allowing the caller of the method to proceed without [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-761","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>The Spring @Async Annotation enables asynchronous processing. - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"The @Async annotation in Spring enables the creation of asynchronous methods. In this tutorial on the Spring framework, we will delve\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/blog\/the-spring-async-annotation-enables-asynchronous-processing\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The Spring @Async Annotation enables asynchronous processing.\" \/>\n<meta property=\"og:description\" content=\"The @Async annotation in Spring enables the creation of asynchronous methods. In this tutorial on the Spring framework, we will delve\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/blog\/the-spring-async-annotation-enables-asynchronous-processing\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/SiliCloudGlobal\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-12-08T07:59:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-12T15:22:13+00:00\" \/>\n<meta name=\"author\" content=\"Jackson Davis\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@SiliCloudGlobal\" \/>\n<meta name=\"twitter:site\" content=\"@SiliCloudGlobal\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jackson Davis\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/the-spring-async-annotation-enables-asynchronous-processing\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/the-spring-async-annotation-enables-asynchronous-processing\/\"},\"author\":{\"name\":\"Jackson Davis\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/55a10b8b0457c35884c25677889ad350\"},\"headline\":\"The Spring @Async Annotation enables asynchronous processing.\",\"datePublished\":\"2023-12-08T07:59:29+00:00\",\"dateModified\":\"2024-03-12T15:22:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/the-spring-async-annotation-enables-asynchronous-processing\/\"},\"wordCount\":711,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\"},\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/the-spring-async-annotation-enables-asynchronous-processing\/\",\"url\":\"https:\/\/www.silicloud.com\/blog\/the-spring-async-annotation-enables-asynchronous-processing\/\",\"name\":\"The Spring @Async Annotation enables asynchronous processing. - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#website\"},\"datePublished\":\"2023-12-08T07:59:29+00:00\",\"dateModified\":\"2024-03-12T15:22:13+00:00\",\"description\":\"The @Async annotation in Spring enables the creation of asynchronous methods. In this tutorial on the Spring framework, we will delve\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/the-spring-async-annotation-enables-asynchronous-processing\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/blog\/the-spring-async-annotation-enables-asynchronous-processing\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/the-spring-async-annotation-enables-asynchronous-processing\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.silicloud.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The Spring @Async Annotation enables asynchronous processing.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/blog\/\",\"name\":\"Silicon Cloud Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\",\"name\":\"Silicon Cloud Blog\",\"url\":\"https:\/\/www.silicloud.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png\",\"contentUrl\":\"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png\",\"width\":1024,\"height\":1024,\"caption\":\"Silicon Cloud Blog\"},\"image\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/SiliCloudGlobal\/\",\"https:\/\/twitter.com\/SiliCloudGlobal\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/55a10b8b0457c35884c25677889ad350\",\"name\":\"Jackson Davis\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/2fdb47d6df1226e92380d96973782572a97b0675d098bb914410dec348eb5d29?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/2fdb47d6df1226e92380d96973782572a97b0675d098bb914410dec348eb5d29?s=96&d=mm&r=g\",\"caption\":\"Jackson Davis\"},\"url\":\"https:\/\/www.silicloud.com\/blog\/author\/jacksondavis\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"The Spring @Async Annotation enables asynchronous processing. - Blog - Silicon Cloud","description":"The @Async annotation in Spring enables the creation of asynchronous methods. In this tutorial on the Spring framework, we will delve","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/blog\/the-spring-async-annotation-enables-asynchronous-processing\/","og_locale":"en_US","og_type":"article","og_title":"The Spring @Async Annotation enables asynchronous processing.","og_description":"The @Async annotation in Spring enables the creation of asynchronous methods. In this tutorial on the Spring framework, we will delve","og_url":"https:\/\/www.silicloud.com\/blog\/the-spring-async-annotation-enables-asynchronous-processing\/","og_site_name":"Blog - Silicon Cloud","article_publisher":"https:\/\/www.facebook.com\/SiliCloudGlobal\/","article_published_time":"2023-12-08T07:59:29+00:00","article_modified_time":"2024-03-12T15:22:13+00:00","author":"Jackson Davis","twitter_card":"summary_large_image","twitter_creator":"@SiliCloudGlobal","twitter_site":"@SiliCloudGlobal","twitter_misc":{"Written by":"Jackson Davis","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.silicloud.com\/blog\/the-spring-async-annotation-enables-asynchronous-processing\/#article","isPartOf":{"@id":"https:\/\/www.silicloud.com\/blog\/the-spring-async-annotation-enables-asynchronous-processing\/"},"author":{"name":"Jackson Davis","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/55a10b8b0457c35884c25677889ad350"},"headline":"The Spring @Async Annotation enables asynchronous processing.","datePublished":"2023-12-08T07:59:29+00:00","dateModified":"2024-03-12T15:22:13+00:00","mainEntityOfPage":{"@id":"https:\/\/www.silicloud.com\/blog\/the-spring-async-annotation-enables-asynchronous-processing\/"},"wordCount":711,"commentCount":0,"publisher":{"@id":"https:\/\/www.silicloud.com\/blog\/#organization"},"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/blog\/the-spring-async-annotation-enables-asynchronous-processing\/","url":"https:\/\/www.silicloud.com\/blog\/the-spring-async-annotation-enables-asynchronous-processing\/","name":"The Spring @Async Annotation enables asynchronous processing. - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/blog\/#website"},"datePublished":"2023-12-08T07:59:29+00:00","dateModified":"2024-03-12T15:22:13+00:00","description":"The @Async annotation in Spring enables the creation of asynchronous methods. In this tutorial on the Spring framework, we will delve","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/blog\/the-spring-async-annotation-enables-asynchronous-processing\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/blog\/the-spring-async-annotation-enables-asynchronous-processing\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/blog\/the-spring-async-annotation-enables-asynchronous-processing\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.silicloud.com\/blog\/"},{"@type":"ListItem","position":2,"name":"The Spring @Async Annotation enables asynchronous processing."}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/blog\/#website","url":"https:\/\/www.silicloud.com\/blog\/","name":"Silicon Cloud Blog","description":"","publisher":{"@id":"https:\/\/www.silicloud.com\/blog\/#organization"},"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.silicloud.com\/blog\/#organization","name":"Silicon Cloud Blog","url":"https:\/\/www.silicloud.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png","contentUrl":"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png","width":1024,"height":1024,"caption":"Silicon Cloud Blog"},"image":{"@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/SiliCloudGlobal\/","https:\/\/twitter.com\/SiliCloudGlobal"]},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/55a10b8b0457c35884c25677889ad350","name":"Jackson Davis","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/2fdb47d6df1226e92380d96973782572a97b0675d098bb914410dec348eb5d29?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2fdb47d6df1226e92380d96973782572a97b0675d098bb914410dec348eb5d29?s=96&d=mm&r=g","caption":"Jackson Davis"},"url":"https:\/\/www.silicloud.com\/blog\/author\/jacksondavis\/"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts\/761","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/comments?post=761"}],"version-history":[{"count":0,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts\/761\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/media?parent=761"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/categories?post=761"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/tags?post=761"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}