Skip to content

Commit 505b3eb

Browse files
committed
edits; fix: Spring Datan -> Spring Data
1 parent e1ff885 commit 505b3eb

8 files changed

+202
-194
lines changed

articles/azure-app-configuration/quickstart-java-spring-app.md

Lines changed: 83 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22
title: Quickstart to learn how to use Azure App Configuration
33
description: In this quickstart, create a Java Spring app with Azure App Configuration to centralize storage and management of application settings separate from your code.
44
services: azure-app-configuration
5-
documentationcenter: ''
65
author: mrm9084
7-
editor: ''
86
ms.service: azure-app-configuration
97
ms.devlang: java
108
ms.topic: quickstart
11-
ms.date: 02/15/2023
9+
ms.date: 02/22/2023
1210
ms.custom: devx-track-java, mode-api
1311
ms.author: mametcal
1412
#Customer intent: As a Java Spring developer, I want to manage all my app settings in one place.
1513
---
14+
1615
# Quickstart: Create a Java Spring app with Azure App Configuration
1716

1817
In this quickstart, you incorporate Azure App Configuration into a Java Spring app to centralize storage and management of application settings separate from your code.
@@ -22,27 +21,27 @@ In this quickstart, you incorporate Azure App Configuration into a Java Spring a
2221
- Azure subscription - [create one for free](https://azure.microsoft.com/free/)
2322
- A supported [Java Development Kit (JDK)](/java/azure/jdk) with version 11.
2423
- [Apache Maven](https://maven.apache.org/download.cgi) version 3.0 or above.
25-
- A Spring Boot application. If you don't have, create a **Maven project** with the [Spring Initializr](https://start.spring.io/). Remember to select **Maven Project** and, under **Dependencies**, add the **Spring Web** dependency, and select Java version 8 or higher.
24+
- A Spring Boot application. If you don't have one, create a Maven project with the [Spring Initializr](https://start.spring.io/). Be sure to select **Maven Project** and, under **Dependencies**, add the **Spring Web** dependency, and then select Java version 8 or higher.
2625

2726
## Create an App Configuration store
2827

2928
[!INCLUDE [azure-app-configuration-create](../../includes/azure-app-configuration-create.md)]
3029

31-
7. Select **Configuration Explorer** > **+ Create** > **Key-value** to add the following key-value pairs:
30+
1. Select **Configuration Explorer** > **+ Create** > **Key-value** to add the following key-value pairs:
3231

33-
| Key | Value |
34-
|---|---|
35-
| /application/config.message | Hello |
32+
| Key | Value |
33+
|---|---|
34+
| /application/config.message | Hello |
3635

37-
Leave **Label** and **Content Type** empty for now.
36+
Leave **Label** and **Content Type** empty for now.
3837

39-
8. Select **Apply**.
38+
1. Select **Apply**.
4039

4140
## Connect to an App Configuration store
4241

4342
Now that you have an App Configuration store, you can use the Spring Cloud Azure Config starter to have your application communicate with the App Configuration store that you create.
4443

45-
To install the Spring Cloud Azure Config starter module, add the following dependency to your `pom.xml` file:
44+
To install the Spring Cloud Azure Config starter module, add the following dependency to your *pom.xml* file:
4645

4746
```xml
4847
<dependency>
@@ -53,122 +52,122 @@ To install the Spring Cloud Azure Config starter module, add the following depen
5352
```
5453

5554
> [!NOTE]
56-
> If you need to support an older version of Spring Boot see our [old library](https://github.com/Azure/azure-sdk-for-java/blob/spring-cloud-starter-azure-appconfiguration-config_1.2.9/sdk/appconfiguration/spring-cloud-starter-azure-appconfiguration-config/README.md).
55+
> If you need to support an older version of Spring Boot, see our [old library](https://github.com/Azure/azure-sdk-for-java/blob/spring-cloud-starter-azure-appconfiguration-config_1.2.9/sdk/appconfiguration/spring-cloud-starter-azure-appconfiguration-config/README.md).
5756
5857
### Code the application
5958

6059
To use the Spring Cloud Azure Config starter to have your application communicate with the App Configuration store that you create, configure the application by using the following steps.
6160

6261
1. Create a new Java file named *MessageProperties.java*, and add the following lines:
6362

64-
```java
65-
import org.springframework.boot.context.properties.ConfigurationProperties;
63+
```java
64+
import org.springframework.boot.context.properties.ConfigurationProperties;
6665

67-
@ConfigurationProperties(prefix = "config")
68-
public class MessageProperties {
69-
private String message;
66+
@ConfigurationProperties(prefix = "config")
67+
public class MessageProperties {
68+
private String message;
7069

71-
public String getMessage() {
72-
return message;
73-
}
70+
public String getMessage() {
71+
return message;
72+
}
7473

75-
public void setMessage(String message) {
76-
this.message = message;
77-
}
78-
}
79-
```
74+
public void setMessage(String message) {
75+
this.message = message;
76+
}
77+
}
78+
```
8079

8180
1. Create a new Java file named *HelloController.java*, and add the following lines:
8281

83-
```java
84-
import org.springframework.web.bind.annotation.GetMapping;
85-
import org.springframework.web.bind.annotation.RestController;
82+
```java
83+
import org.springframework.web.bind.annotation.GetMapping;
84+
import org.springframework.web.bind.annotation.RestController;
8685

87-
@RestController
88-
public class HelloController {
89-
private final MessageProperties properties;
86+
@RestController
87+
public class HelloController {
88+
private final MessageProperties properties;
9089

91-
public HelloController(MessageProperties properties) {
92-
this.properties = properties;
93-
}
90+
public HelloController(MessageProperties properties) {
91+
this.properties = properties;
92+
}
9493

95-
@GetMapping
96-
public String getMessage() {
97-
return "Message: " + properties.getMessage();
98-
}
99-
}
100-
```
94+
@GetMapping
95+
public String getMessage() {
96+
return "Message: " + properties.getMessage();
97+
}
98+
}
99+
```
101100

102101
1. In the main application Java file, add `@EnableConfigurationProperties` to enable the *MessageProperties.java* configuration properties class to take effect and register it with the Spring container.
103102

104-
```java
105-
import org.springframework.boot.context.properties.EnableConfigurationProperties;
103+
```java
104+
import org.springframework.boot.context.properties.EnableConfigurationProperties;
106105

107-
@SpringBootApplication
108-
@EnableConfigurationProperties(MessageProperties.class)
109-
public class DemoApplication {
110-
public static void main(String[] args) {
111-
SpringApplication.run(DemoApplication.class, args);
112-
}
113-
}
114-
```
106+
@SpringBootApplication
107+
@EnableConfigurationProperties(MessageProperties.class)
108+
public class DemoApplication {
109+
public static void main(String[] args) {
110+
SpringApplication.run(DemoApplication.class, args);
111+
}
112+
}
113+
```
115114

116-
1. Open the auto-generated unit test and update to disable Azure App Configuration, or it will try to load from the service when runnings unit tests.
115+
1. Open the auto-generated unit test and update to disable Azure App Configuration, or it will try to load from the service when running unit tests.
117116

118-
```java
119-
import org.junit.jupiter.api.Test;
120-
import org.springframework.boot.test.context.SpringBootTest;
117+
```java
118+
import org.junit.jupiter.api.Test;
119+
import org.springframework.boot.test.context.SpringBootTest;
121120

122-
@SpringBootTest(properties = "spring.cloud.azure.appconfiguration.enabled=false")
123-
class DemoApplicationTests {
121+
@SpringBootTest(properties = "spring.cloud.azure.appconfiguration.enabled=false")
122+
class DemoApplicationTests {
124123

125-
@Test
126-
void contextLoads() {
127-
}
124+
@Test
125+
void contextLoads() {
126+
}
128127

129-
}
130-
```
128+
}
129+
```
131130

132-
1. Create a new file named `bootstrap.properties` under the resources directory of your app, and add the following line to the file.
131+
1. Create a new file named *bootstrap.properties* under the resources directory of your app, and add the following line to the file.
133132

134-
```properties
135-
spring.cloud.azure.appconfiguration.stores[0].connection-string= ${APP_CONFIGURATION_CONNECTION_STRING}
136-
```
133+
```properties
134+
spring.cloud.azure.appconfiguration.stores[0].connection-string= ${APP_CONFIGURATION_CONNECTION_STRING}
135+
```
137136

138137
1. Set an environment variable named **APP_CONFIGURATION_CONNECTION_STRING**, and set it to the access key to your App Configuration store. At the command line, run the following command and restart the command prompt to allow the change to take effect:
139138

140-
```cmd
141-
setx APP_CONFIGURATION_CONNECTION_STRING "connection-string-of-your-app-configuration-store"
142-
```
139+
```cmd
140+
setx APP_CONFIGURATION_CONNECTION_STRING "connection-string-of-your-app-configuration-store"
141+
```
143142

144-
If you use Windows PowerShell, run the following command:
143+
If you use Windows PowerShell, run the following command:
145144

146-
```azurepowershell
147-
$Env:APP_CONFIGURATION_CONNECTION_STRING = "connection-string-of-your-app-configuration-store"
148-
```
145+
```azurepowershell
146+
$Env:APP_CONFIGURATION_CONNECTION_STRING = "connection-string-of-your-app-configuration-store"
147+
```
149148

150-
If you use macOS or Linux, run the following command:
149+
If you use macOS or Linux, run the following command:
151150

152-
```cmd
153-
export APP_CONFIGURATION_CONNECTION_STRING='connection-string-of-your-app-configuration-store'
154-
```
151+
```cmd
152+
export APP_CONFIGURATION_CONNECTION_STRING='connection-string-of-your-app-configuration-store'
153+
```
155154

156155
### Build and run the app locally
157156

158157
1. Open command prompt to the root directory and run the following commands to build your Spring Boot application with Maven and run it.
159158

160-
```cmd
161-
mvn clean package
162-
mvn spring-boot:run
163-
```
159+
```cmd
160+
mvn clean package
161+
mvn spring-boot:run
162+
```
164163

165164
1. After your application is running, use *curl* to test your application, for example:
166165

167-
```cmd
168-
curl -X GET http://localhost:8080/
169-
```
166+
```cmd
167+
curl -X GET http://localhost:8080/
168+
```
170169

171-
You see the message that you entered in the App Configuration store.
170+
You see the message that you entered in the App Configuration store.
172171

173172
## Clean up resources
174173

articles/cosmos-db/nosql/performance-tips-query-sdk.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ To execute a query, a query plan needs to be built. This in general represents a
248248

249249
### Use Query Plan caching
250250

251-
The query plan, for a query scoped to a single partition, is cached on the client. This eliminates the need to make a call to the gateway to retrieve the query plan after the first call. The key for the cached query plan is the SQL query string. You need to **make sure the query is [parametrized](query/parameterized-queries.md)**. If not, the query plan cache lookup will often be a cache miss as the query string is unlikely to be identical across calls. Query plan caching is **enabled by default for Java SDK version 4.20.0 and above** and **for Spring Datan Azure Cosmos DB SDK version 3.13.0 and above**.
251+
The query plan, for a query scoped to a single partition, is cached on the client. This eliminates the need to make a call to the gateway to retrieve the query plan after the first call. The key for the cached query plan is the SQL query string. You need to **make sure the query is [parametrized](query/parameterized-queries.md)**. If not, the query plan cache lookup will often be a cache miss as the query string is unlikely to be identical across calls. Query plan caching is **enabled by default for Java SDK version 4.20.0 and above** and **for Spring Data Azure Cosmos DB SDK version 3.13.0 and above**.
252252

253253
### Use parametrized single partition queries
254254

0 commit comments

Comments
 (0)