{"id":5291,"date":"2023-01-12T07:05:46","date_gmt":"2023-01-12T15:05:46","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cosmosdb\/?p=5291"},"modified":"2023-01-26T11:12:58","modified_gmt":"2023-01-26T19:12:58","slug":"building-and-deploying-java-apps-with-spring-cloud-and-azure-cosmos-db","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cosmosdb\/building-and-deploying-java-apps-with-spring-cloud-and-azure-cosmos-db\/","title":{"rendered":"Building and deploying Java apps with Spring Cloud and Azure Cosmos DB"},"content":{"rendered":"<p>On a recent <a href=\"https:\/\/youtu.be\/_Nen3owmLAs\" target=\"_blank\" rel=\"noopener\">episode of Azure Cosmos DB Live TV,<\/a> I discussed building Java apps with Azure Cosmos DB and Spring Cloud. The focus of the discussion was how to use <a href=\"https:\/\/spring.io\/projects\/spring-cloud-azure\" target=\"_blank\" rel=\"noopener\">Spring Cloud Azure<\/a>, an open-source project that provides seamless Spring integration with Azure services and gives developers a Spring-idiomatic way to connect and consume Azure services, with only a few lines of configuration and minimal code changes.<\/p>\n<p>Each starter project in Spring Cloud Azure includes all the dependencies and transitive dependencies needed to begin application development with Azure services. For example, if you want to get started using Azure Cosmos DB for data persistence, you must include the\u00a0<strong>spring-cloud-azure-starter-cosmos<\/strong>\u00a0dependency in your project.<\/p>\n<p>This blog shows you how to deploy an existing Java Spring Cloud application to Azure. The Spring Petclinic Microservices project (forked <a href=\"https:\/\/github.com\/spring-petclinic\/spring-petclinic-microservices\" target=\"_blank\" rel=\"noopener\">from here<\/a>) is built around small independent services (a few hundred lines of code), running in their own JVM and communicating over HTTP via a REST API.<\/p>\n<p>In its default configuration, Petclinic uses an in-memory database (HSQLDB) which gets populated at start-up with data. This fork utilizes <a href=\"https:\/\/learn.microsoft.com\/azure\/key-vault\/general\/overview\" target=\"_blank\" rel=\"noopener\">Azure Key Vault<\/a> for credential storage, <a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/introduction\" target=\"_blank\" rel=\"noopener\">Azure Cosmos DB<\/a>, fronted by an instance of <a href=\"https:\/\/learn.microsoft.com\/azure\/azure-cache-for-redis\/\" target=\"_blank\" rel=\"noopener\">Azure Cache for Redis<\/a>, for data persistence.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2022\/12\/Picture-1.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-5294\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2022\/12\/Picture-1.png\" alt=\"Image Picture 1\" width=\"1384\" height=\"779\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2022\/12\/Picture-1.png 1384w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2022\/12\/Picture-1-300x169.png 300w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2022\/12\/Picture-1-1024x576.png 1024w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2022\/12\/Picture-1-768x432.png 768w\" sizes=\"(max-width: 1384px) 100vw, 1384px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3>What will you experience<\/h3>\n<ul>\n<li>Build existing Spring microservice applications<\/li>\n<li>Provision azure resources required for the applications<\/li>\n<li>Run the applications locally with Azure Cosmos DB backend, Azure Cache for Redis, and using Azure Key Vault for storing secrets<\/li>\n<\/ul>\n<h3>What you will need<\/h3>\n<ul>\n<li><a href=\"https:\/\/azure.microsoft.com\/free\/\">An Azure subscription<\/a><\/li>\n<li><a href=\"https:\/\/www.terraform.io\/\">Terraform<\/a><\/li>\n<li><a href=\"https:\/\/www.oracle.com\/java\/technologies\/downloads\/\">JDK8<\/a>\u00a0or later<\/li>\n<li><a href=\"https:\/\/git-scm.com\/\">Git<\/a><\/li>\n<li><a href=\"https:\/\/stedolan.github.io\/jq\/\">Jq<\/a><\/li>\n<li><a href=\"https:\/\/www.docker.com\/\">Docker<\/a><\/li>\n<li><a href=\"https:\/\/maven.apache.org\/download.cgi\">Maven<\/a><\/li>\n<\/ul>\n<h3>Clone and build the samples repository<\/h3>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">git clone https:\/\/github.com\/Azure-Samples\/azure-spring-boot-samples<\/code><\/pre>\n<h3 style=\"background: white; margin: 18.0pt 0cm 12.0pt 0cm;\"><span style=\"font-size: 15.0pt; font-family: 'Segoe UI',sans-serif; color: #24292f;\">Change directory and build the project<\/span><\/h3>\n<pre class=\"prettyprint language-default\">cd azure-spring-boot-samples\/spring-petclinic-microservices\r\nmvn clean package -DskipTests\r\n<\/pre>\n<p style=\"background: white; margin: 0cm 0cm 12.0pt 0cm;\"><span style=\"font-family: 'Segoe UI',sans-serif; color: #24292f;\">This will take a few minutes.<\/span><\/p>\n<h3>Provision Azure Resources Required to Run This Sample<\/h3>\n<p style=\"background: white; margin: 0cm 0cm 12.0pt 0cm;\"><span style=\"font-family: 'Segoe UI',sans-serif; color: #24292f;\">Terraform must authenticate to Azure to create infrastructure.<\/span><\/p>\n<p style=\"background: white; margin: 0cm 0cm 12.0pt 0cm;\"><span style=\"font-family: 'Segoe UI',sans-serif; color: #24292f;\">In your terminal, use the Azure CLI tool to setup your account permissions locally.<\/span><\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">az login<\/code><\/pre>\n<p>Your browser window will open and you will be prompted to enter your Azure login credentials. After successful authentication, your terminal will display your subscription information. You do not need to save this output as it is saved in your system for Terraform to use.<\/p>\n<p>You have logged in. Now let us find all the subscriptions to which you have access&#8230;<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">[\r\n  {\r\n    \"cloudName\": \"AzureCloud\",\r\n    \"homeTenantId\": \"home-Tenant-Id\",\r\n    \"id\": \"subscription-id\",\r\n    \"isDefault\": true,\r\n    \"managedByTenants\": [],\r\n    \"name\": \"Subscription-Name\",\r\n    \"state\": \"Enabled\",\r\n    \"tenantId\": \"0envbwi39-TenantId\",\r\n    \"user\": {\r\n      \"name\": \"your-username@domain.com\",\r\n      \"type\": \"user\"\r\n    }\r\n  }\r\n]\r\n<\/code><\/pre>\n<p style=\"background: white; margin: 0cm 0cm 12.0pt 0cm;\"><span style=\"font-family: 'Segoe UI',sans-serif; color: #24292f;\">If you have more than one subscription, specify the subscription-id you want to use with command below:<\/span><\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">az account set --subscription &lt;your-subscription-id&gt;<\/code><\/pre>\n<h3>Provision the Resources<\/h3>\n<p style=\"background: white; margin: 0cm 0cm 12.0pt 0cm;\"><span style=\"font-family: 'Segoe UI',sans-serif; color: #24292f;\">After login Azure CLI with your account, now you can use the terraform script to create Azure Resources.<\/span><\/p>\n<h5>Run with Bash<\/h5>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\"># In the root directory of the sample\r\n# Initialize your Terraform configuration\r\nterraform -chdir=.\/terraform init\r\n\r\n# Apply your Terraform Configuration\r\nterraform -chdir=.\/terraform apply -auto-approve\r\n<\/code><\/pre>\n<h5>Run with Powershell<\/h5>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\"># In the root directory of the sample\r\n# Initialize your Terraform configuration\r\nterraform -chdir=terraform init\r\n\r\n# Apply your Terraform Configuration\r\nterraform -chdir=terraform apply -auto-approve\r\n<\/code><\/pre>\n<p style=\"background: white; margin: 0cm 0cm 12.0pt 0cm;\"><span style=\"font-family: 'Segoe UI',sans-serif; color: #24292f;\">It may take a few minutes to run the script. After successful running, you will see prompt information like below:<\/span><\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">azurerm_resource_group.main: Creating...\r\nazurerm_key_vault.kv_account: Creating...\r\nazurerm_redis_cache.redis: Creating...\r\nazurerm_cosmosdb_account.application: Creating...\r\nazurerm_redis_cache.redis: Still creating... \r\nazurerm_key_vault.kv_account: Still creating... \r\nazurerm_cosmosdb_account.application: Still creating... \r\n...\r\nazurerm_cosmosdb_account.application: Still creating...\r\nazurerm_redis_cache.redis: Still creating...\r\nazurerm_key_vault.kv_account: Still creating...\r\nazurerm_key_vault.kv_account: Still creating...\r\nazurerm_redis_cache.redis: Still creating... \r\n...\r\n\r\nApply complete! Resources: 11 added, 0 changed, 0 destroyed.\r\n\r\nOutputs:\r\n...\r\n<\/code><\/pre>\n<p>You can go to\u00a0<a href=\"https:\/\/ms.portal.azure.com\/\">Azure portal<\/a>\u00a0in your web browser to check the resources you created.<\/p>\n<h3>Export Output to Your Local Environment<\/h3>\n<p style=\"background: white; margin: 0cm 0cm 12.0pt 0cm;\"><span style=\"font-family: 'Segoe UI',sans-serif; color: #24292f;\">In the same window you ran the terraform command, run the command below to export its environment values:<\/span><\/p>\n<h5>Run with Bash<\/h5>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">source .\/terraform\/setup_env.sh<\/code><code class=\"language-default\"><\/code><\/pre>\n<h5>Run with Powershell<\/h5>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">terraform\\setup_env.ps1<\/code><\/pre>\n<p style=\"background: white; margin: 0cm 0cm 12.0pt 0cm;\"><span style=\"font-family: 'Segoe UI',sans-serif; color: #24292f;\">make sure keyvault.env file is created at the root of the repo.<\/span><\/p>\n<h3 style=\"background: white; margin: 18.0pt 0cm 12.0pt 0cm;\"><span style=\"font-family: 'Segoe UI',sans-serif; color: #24292f;\">Starting services locally with docker-compose<\/span><\/h3>\n<p style=\"background: white; margin: 0cm 0cm 12.0pt 0cm;\"><span style=\"font-family: 'Segoe UI',sans-serif; color: #24292f;\">In order to start entire infrastructure using Docker, you have to build images by executing command below from a project root:<\/span><\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">mvn clean install -P buildDocker -DskipTests\r\n\r\n<\/code><\/pre>\n<p style=\"background: white; margin: 0cm 0cm 12.0pt 0cm;\"><span style=\"font-family: 'Segoe UI',sans-serif; color: #24292f;\">Once images are ready, you can start them with a single command.<\/span><\/p>\n<pre style=\"background: white;\"><span style=\"font-size: 12.0pt; font-family: Menlo; color: #24292f;\">docker-compose up<\/span><\/pre>\n<p>Containers startup order is coordinated with\u00a0<a href=\"https:\/\/github.com\/jwilder\/dockerize\">dockerize\u00a0script<\/a>. After starting services it takes a while for API Gateway to be in sync with service registry, so don&#8217;t be scared of initial Spring Cloud Gateway timeouts. You can track services availability using Eureka dashboard available by default at\u00a0<a href=\"http:\/\/localhost:8761\">http:\/\/localhost:8761<\/a>.<\/p>\n<p>If certain on your services don\u2019t start-up, we recommend running \u201cdocker-compose down\u201d and then \u201cdocker-compose up\u201d until all the services are available.<\/p>\n<p>You can then access the petclinic here:\u00a0<a href=\"http:\/\/localhost:8080\/\">http:\/\/localhost:8080\/<\/a><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2022\/12\/Picture-2.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-5295\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2022\/12\/Picture-2.png\" alt=\"Image Picture 2\" width=\"904\" height=\"700\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2022\/12\/Picture-2.png 904w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2022\/12\/Picture-2-300x232.png 300w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2022\/12\/Picture-2-768x595.png 768w\" sizes=\"(max-width: 904px) 100vw, 904px\" \/><\/a><\/p>\n<h3>Azure Cache for Redis fronting Azure Cosmos DB<\/h3>\n<p><a href=\"https:\/\/azure.microsoft.com\/en-us\/services\/cache\/?WT.mc_id=devto-blog-judubois\">Azure Cache for Redis<\/a> is a fully managed Redis cache hosted by Azure. It has a very inexpensive first tier, and for our current use-case, it&#8217;s a perfect choice as we tried to be budget-conscious and as it can scale out without any trouble for us.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2022\/12\/Picture-3.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-5296\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2022\/12\/Picture-3.png\" alt=\"Image Picture 3\" width=\"720\" height=\"834\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2022\/12\/Picture-3.png 720w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2022\/12\/Picture-3-259x300.png 259w\" sizes=\"(max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Our example is already setup for Azure Cache for Redis with the following dependency in the \u201cspring-petclinic-customers-service\/pom.xml\u201d file:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">    &lt;dependency&gt;\r\n      &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n      &lt;artifactId&gt;spring-boot-starter-data-redis&lt;\/artifactId&gt;\r\n    &lt;\/dependency&gt;\r\n<\/code><code class=\"language-default\"><\/code><\/pre>\n<p>And we configured the Azure Cosmos DB database and Redis cache in the \u201cspring-petclinic-customers-service\/src\/main\/resources\/application.yaml\u201d Spring Boot configuration file:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">      cosmos:\r\n        database: end2endsample\r\n        endpoint: ${cosmosdburi}\r\n        key: ${cosmosdbkey}\r\n        populate-query-metrics: true\r\n  cache:\r\n    type: redis\r\n  redis:\r\n    host: ${redisuri}\r\n    password: ${redispassword}\r\n    port: 6380\r\n    ssl: true\r\n<\/code><\/pre>\n<h3><code class=\"language-default\"><\/code><\/h3>\n<p>Next, let\u2019s invalidate the cache and monitor it on the Azure Portal.<\/p>\n<p>In the Customer Service project, you will notice the \u201cCacheable\u201d and \u201cCacheEvict\u201d annotations on the \u201ccustomers\/web\/OwnerResource.java\u201d class:<\/p>\n<pre class=\"prettyprint language-java\"><code class=\"language-java\">    \/**\r\n     * Read List of Owners\r\n     *\/\r\n  @GetMapping\r\n  @Cacheable(\"owners\")\r\n  public List&lt;Owner&gt; findAll() {\r\n    List&lt;Owner&gt; list = new ArrayList&lt;&gt;();\r\n    ownerRepository.findAll().forEach(list::add);\r\n    return list;\r\n  }\r\n\r\n    \/**\r\n     * Clears the cache for all Owners\r\n     *\/\r\n  @GetMapping(value = \"\/clearcache\")\r\n  @CacheEvict(\"owners\")\r\n  @ResponseStatus(HttpStatus.NO_CONTENT)\r\n  public void clearAllCache() {}\r\n\r\n<\/code><\/pre>\n<p>So whenever you access the URL <a href=\"http:\/\/localhost:8080\/api\/customer\/owners\">http:\/\/localhost:8080\/api\/customer\/owners<\/a> it will return and cache the list of owners into the Azure Redis cache.<\/p>\n<p>To clear the cache open a new browser window and access the URL\u00a0<a href=\"http:\/\/localhost:8080\/api\/customer\/owners\/clearcache\">http:\/\/localhost:8080\/api\/customer\/owners\/clearcache<\/a> (it will return a blank screen).<\/p>\n<p>When you go back and list all the owners (<a href=\"http:\/\/localhost:8080\/api\/customer\/owners\">http:\/\/localhost:8080\/api\/customer\/owners<\/a>), you\u2019ll notice a delay as the cache is hydrated again with a complete list of Owner objects.<\/p>\n<p>To view basic cache metrics in the\u00a0<a href=\"https:\/\/portal.azure.com\/\">Azure portal<\/a>. On the left, select\u00a0<strong>Overview<\/strong>. You see the following predefined monitoring charts:\u00a0<strong>Memory Usage<\/strong>\u00a0and\u00a0<strong>Redis Server Load<\/strong>. These charts are helpful summaries that allow you to take a quick look at the state of your Customer object cache.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2022\/12\/Picture-4.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-5297\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2022\/12\/Picture-4.png\" alt=\"Image Picture 4\" width=\"604\" height=\"634\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2022\/12\/Picture-4.png 604w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2022\/12\/Picture-4-286x300.png 286w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2022\/12\/Picture-4-24x24.png 24w\" sizes=\"(max-width: 604px) 100vw, 604px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h3>Clean Up Resources<\/h3>\n<p>Stop the docker container running with the following command:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">docker-compose down\r\n\r\n<\/code><\/pre>\n<p>After running the sample, if you don&#8217;t want to run the sample again, remember to destroy the Azure resources you created to avoid unnecessary billing.<\/p>\n<p>The terraform destroy command terminates resources managed by your Terraform project.\nTo destroy the resources you created:<\/p>\n<h5>Run with Bash<\/h5>\n<p>az group delete &#8211;name $(terraform -chdir=.\/terraform output -raw resource_group_name) &#8211;yes<\/p>\n<h5>Run with Powershell<\/h5>\n<p>az group delete &#8211;name $(terraform -chdir=terraform output -raw resource_group_name) &#8211;yes<\/p>\n<h3>Conclusion<\/h3>\n<p>Using Spring Boot, Spring Cloud, Azure Cosmos DB, and Azure Cache for Redis together can help to create a robust and scalable microservices architecture. Spring Boot makes it easy to create standalone, production-grade applications that can be easily deployed and run. Spring Cloud provides a set of tools for building cloud-native applications, including support for service discovery, configuration management, and distributed tracing. Azure Cosmos DB is a globally distributed, multi-model database service that can be used as a data store for microservices. Azure Cache for Redis is an in-memory data structure store that can be used to improve the performance and scalability of a microservices architecture.<\/p>\n<p>In summary, using these tools together can help to create a microservices architecture that is easy to develop, maintain, and scale.<\/p>\n<p>Watch the full episode here:<\/p>\n<p><iframe title=\"Getting started with Java and Spring Cloud Azure to build Azure Cosmos DB Java Apps - Episode 63\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/_Nen3owmLAs?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<h3>Samples<\/h3>\n<ul>\n<li>Git Repo: <a href=\"https:\/\/github.com\/Azure-Samples\/azure-spring-boot-samples\/tree\/spring-cloud-azure_v4.4.1\/spring-petclinic-microservices\">https:\/\/github.com\/Azure-Samples\/azure-spring-boot-samples\/tree\/spring-cloud-azure_v4.4.1\/spring-petclinic-microservices<\/a>\n<ul>\n<li><a href=\"https:\/\/microsoft.github.io\/spring-cloud-azure\/6.0.0-beta.3\/reference\/html\/index.html\">Spring Cloud Azure:6.0.0-beta.3 <\/a>has released, this is a milestone version to support Spring boot 3.<\/li>\n<\/ul>\n<\/li>\n<li>Understanding the Spring Petclinic application\n<ul>\n<li><a href=\"http:\/\/fr.slideshare.net\/AntoineRey\/spring-framework-petclinic-sample-application\">See the presentation of the Spring Petclinic Framework version<\/a><\/li>\n<li><a href=\"http:\/\/javaetmoi.com\/2018\/10\/architecture-microservices-avec-spring-cloud\/\">A blog bost introducing the Spring Petclinic Microsevices <\/a>(French language)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>Get Started with Java in Azure Cosmos DB<\/h3>\n<ul>\n<li><a href=\"https:\/\/docs.microsoft.com\/azure\/cosmos-db\/sql\/sql-api-sdk-java-v4\">Azure Cosmos DB Java SDK v4 technical documentation<\/a><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/cosmos-db\/sql\/sql-api-java-sdk-samples\">Java SDK v4 getting started sample application<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/Azure-Samples\/azure-spring-data-cosmos-java-sql-api-samples\">Azure Cosmos DB Spring Data Sample<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/AzureCosmosDB\/CosmicWorksJava\">Cosmic Works Java<\/a><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/cosmos-db\/sql\/sql-api-sdk-java-v4\">Release notes and additional resources<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/java-sdk-v4-async-vs-sync\/\">Exploring the Async API (reactor programming)<\/a><\/li>\n<\/ul>\n<h3>About Azure Cosmos DB<\/h3>\n<p><a href=\"https:\/\/azure.microsoft.com\/services\/cosmos-db\/\">Azure Cosmos DB<\/a> is a fast and scalable distributed NoSQL database, built for modern application development. Get guaranteed single-digit millisecond response times and 99.999-percent availability, <a href=\"https:\/\/azure.microsoft.com\/support\/legal\/sla\/cosmos-db\/\">backed by SLAs<\/a>, <a href=\"https:\/\/docs.microsoft.com\/azure\/cosmos-db\/scaling-throughput\">automatic and instant scalability<\/a>, and open-source APIs for MongoDB and Cassandra. Enjoy fast writes and reads anywhere in the world with turnkey data replication and multi-region writes.<\/p>\n<p>To easily build your first database, watch our <a href=\"https:\/\/youtube.com\/playlist?list=PLmamF3YkHLoLLGUtSoxmUkORcWaTyHlXp\">Get Started videos<\/a> on YouTube and explore ways to <a href=\"https:\/\/docs.microsoft.com\/azure\/cosmos-db\/optimize-dev-test\">dev\/test free<\/a><\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-java\"><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>On a recent episode of Azure Cosmos DB Live TV, I discussed building Java apps with Azure Cosmos DB and Spring Cloud. The focus of the discussion was how to use Spring Cloud Azure, an open-source project that provides seamless Spring integration with Azure services and gives developers a Spring-idiomatic way to connect and consume [&hellip;]<\/p>\n","protected":false},"author":29534,"featured_media":5295,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[14,1849],"tags":[],"class_list":["post-5291","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-core-sql-api","category-spring-data"],"acf":[],"blog_post_summary":"<p>On a recent episode of Azure Cosmos DB Live TV, I discussed building Java apps with Azure Cosmos DB and Spring Cloud. The focus of the discussion was how to use Spring Cloud Azure, an open-source project that provides seamless Spring integration with Azure services and gives developers a Spring-idiomatic way to connect and consume [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/5291","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/users\/29534"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/comments?post=5291"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/5291\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media\/5295"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media?parent=5291"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/categories?post=5291"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/tags?post=5291"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}