You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This step is optional. If you're interested in learning how the database resources are created in the code, you can review the following snippets. Otherwise, you can skip ahead to [Run the app](#run-the-app).
@@ -121,114 +121,38 @@ After creating the Azure Cosmos DB account, database and container, Spring Boot/
121
121
122
122
The sample code has already been added, you don't need to add any code.
123
123
124
-
# [Password](#tab/password)
124
+
## [Password](#tab/password)
125
125
126
126
### Application configuration file
127
127
128
128
Here we showcase how Spring Boot and Spring Data enhance user experience - the process of establishing an Azure Cosmos DB client and connecting to Azure Cosmos DB resources is now config rather than code. At application startup Spring Boot handles all of this boilerplate using the settings in **application.yml**:
Once you create an Azure Cosmos DB account, database, and container, just fill-in-the-blanks in the config file and Spring Boot/Spring Data will automatically do the following: (1) create an underlying Java SDK `CosmosClient` instance with the URI and key, and (2) connect to the database and container. You're all set - **no more resource management code!**
142
141
143
142
### Java source
144
143
145
-
The Spring Data value-add also comes from its simple, clean, standardized and platform-independent interface for operating on datastores. Building on the Spring Data GitHub sample linked above, below are CRUD and query samples for manipulating Azure Cosmos DB documents with Spring Data Azure Cosmos DB.
146
-
147
-
1. Create a new Java file named *MessageProperties.java* as an entity stored in Azure Cosmos DB. The following code ignores the `getters` and `setters` methods.
The sample code has already been added, you don't need to add any code.
225
145
226
146
---
227
147
148
+
228
149
## Run the app
229
150
230
151
Now go back to the Azure portal to get your connection string information and launch the app with your endpoint information. This enables your app to communicate with your hosted database.
231
152
153
+
>[!TIP]
154
+
> Before starting the following sections, replace the variables in *application.yml* with real values. If you use Passwordless authentication, use Azure CLI, Visual Studio Code, PowerShell, or other methods to complete the authentication.
155
+
232
156
1. In the git terminal window, `cd` to the sample code folder.
0 commit comments