Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support finding applicationinsights.json in current dir when using runtime attach #3990

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

trask
Copy link
Member

@trask trask commented Dec 19, 2024

Resolves #3989

@jeanbisutti
Copy link
Member

Spring Boot can also retrieve configuration files in the /config subdirectory of the current directory: https://docs.spring.io/spring-boot/docs/2.0.x/reference/html/boot-features-external-config.html#boot-features-external-config-application-property-files

The Application Insights json file could also be retrieved from this subdirectory.

try {
return Files.newInputStream(defaultFile.toPath());
} catch (IOException e) {
throw new IllegalStateException(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -52,7 +55,10 @@ public static void attach() {
System.setProperty(RUNTIME_ATTACHED_ENABLED_PROPERTY, "true");

try {
Optional<String> jsonConfig = findJsonConfig();
Optional<String> jsonConfig = findJsonConfigFromClasspath();
if (!jsonConfig.isPresent()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's assume the user adds a JSON configuration file in src/main/resources and creates a Spring Boot executable JAR.

The user may want to use a configuration different from the default one in the classpath without creating a new JAR file.

It may be useful to check the configuration from the file system first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Support for Loading applicationinsights.json from Current Working Directory (CWD)
2 participants