Skip to content

Commit 8073b31

Browse files
authored
Merge pull request #214696 from jeanbisutti/rt-attach-json
Update Spring Boot
2 parents 55f246c + f27b9ec commit 8073b31

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

articles/azure-monitor/app/java-spring-boot.md

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@ There are two options for enabling Application Insights Java with Spring Boot: J
1313

1414
## Enabling with JVM argument
1515

16-
Add the JVM arg `-javaagent:"path/to/applicationinsights-agent-3.4.1.jar"` somewhere before `-jar`, for example:
16+
Add the JVM arg `-javaagent:"path/to/applicationinsights-agent-3.4.2.jar"` somewhere before `-jar`, for example:
1717

1818
```
19-
java -javaagent:"path/to/applicationinsights-agent-3.4.1.jar" -jar <myapp.jar>
19+
java -javaagent:"path/to/applicationinsights-agent-3.4.2.jar" -jar <myapp.jar>
2020
```
2121

2222
### Spring Boot via Docker entry point
2323

24-
If you're using the *exec* form, add the parameter `-javaagent:"path/to/applicationinsights-agent-3.4.1.jar"` to the parameter list somewhere before the `"-jar"` parameter, for example:
24+
If you're using the *exec* form, add the parameter `-javaagent:"path/to/applicationinsights-agent-3.4.2.jar"` to the parameter list somewhere before the `"-jar"` parameter, for example:
2525

2626
```
27-
ENTRYPOINT ["java", "-javaagent:path/to/applicationinsights-agent-3.4.1.jar", "-jar", "<myapp.jar>"]
27+
ENTRYPOINT ["java", "-javaagent:path/to/applicationinsights-agent-3.4.2.jar", "-jar", "<myapp.jar>"]
2828
```
2929

30-
If you're using the *shell* form, add the JVM arg `-javaagent:"path/to/applicationinsights-agent-3.4.1.jar"` somewhere before `-jar`, for example:
30+
If you're using the *shell* form, add the JVM arg `-javaagent:"path/to/applicationinsights-agent-3.4.2.jar"` somewhere before `-jar`, for example:
3131

3232
```
33-
ENTRYPOINT java -javaagent:"path/to/applicationinsights-agent-3.4.1.jar" -jar <myapp.jar>
33+
ENTRYPOINT java -javaagent:"path/to/applicationinsights-agent-3.4.2.jar" -jar <myapp.jar>
3434
```
3535

3636
### Configuration
@@ -45,24 +45,24 @@ To enable Application Insights Java programmatically, you must add the following
4545
<dependency>
4646
<groupId>com.microsoft.azure</groupId>
4747
<artifactId>applicationinsights-runtime-attach</artifactId>
48-
<version>3.4.1</version>
48+
<version>3.4.2</version>
4949
</dependency>
5050
```
5151

5252
And invoke the `attach()` method of the `com.microsoft.applicationinsights.attach.ApplicationInsights` class
5353
in the first line of your `main()` method.
5454

55+
> [!WARNING]
56+
>
57+
> The invocation must be at the beginning of the `main` method.
58+
5559
> [!WARNING]
5660
>
5761
> JRE is not supported.
5862
5963
> [!WARNING]
6064
>
61-
> Read-only file system is not supported.
62-
63-
> [!WARNING]
64-
>
65-
> The invocation must be at the beginning of the `main` method.
65+
> The temporary directory of the operating system should be writable.
6666
6767
Example:
6868

@@ -79,20 +79,23 @@ public class SpringBootApp {
7979

8080
### Configuration
8181

82-
> [!NOTE]
83-
> Spring's `application.properties` or `application.yaml` files are not supported as
84-
> as sources for Application Insights Java configuration.
85-
8682
Programmatic enablement supports all the same [configuration options](./java-standalone-config.md)
8783
as the JVM argument enablement, with the following differences below.
8884

8985
#### Configuration file location
9086

9187
By default, when enabling Application Insights Java programmatically, the configuration file `applicationinsights.json`
92-
will be read from the classpath.
88+
will be read from the classpath (`src/main/resources`, `src/test/resources`).
89+
90+
From 3.4.2, you can configure the name of a JSON file in the classpath with the `applicationinsights.runtime-attach.configuration.classpath.file` system property.
91+
For example, with `-Dapplicationinsights.runtime-attach.configuration.classpath.file=applicationinsights-dev.json`, Application Insights will use `applicationinsights-dev.json` file for configuration.
92+
93+
> [!NOTE]
94+
> Spring's `application.properties` or `application.yaml` files are not supported as
95+
> as sources for Application Insights Java configuration.
9396
9497
See [configuration file path configuration options](./java-standalone-config.md#configuration-file-path)
95-
to change this location.
98+
to change the location for a file outside the classpath.
9699

97100
#### Self-diagnostic log file location
98101

0 commit comments

Comments
 (0)