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
It is a useful feature for Spring Boot to load external configuration files (files not included in the exectuable jar) at runtime. This allows you to override some properties in production for example. You can do this via command line arguments, but the property file approach is common.
Spring Boot will automatically find and load application.properties and application.yaml files from the following locations when your application starts:
The current directory
The /config subdirectory in the current directory
Immediate child directories of the /config subdirectory
This works if you launch the rules_spring built executable jar with java -jar:
java -jar example.jar
But we don't have a great way to do this when launching the application with bazel run. As a workaround the developer can invoke bazel run like this:
bazel run //examples/demoapp -- --spring.config.location=/tmp/demoapp/config/
but it feels like we should automatically honor package level files like:
which adds the config files to the target's runfiles. Then, we should derive the directories from the data list that contain application*.properties files, and add those directories to a auto spring.config.location option passed when invoking the JVM.
That said, I am having problems finding a good way to resolve the paths to each data file prior to handing off to the write_bazelrun_env.sh shell script. This probably has to wait until we remove shell scripts from the impl.
It is a useful feature for Spring Boot to load external configuration files (files not included in the exectuable jar) at runtime. This allows you to override some properties in production for example. You can do this via command line arguments, but the property file approach is common.
https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config.files
This works if you launch the rules_spring built executable jar with
java -jar
:But we don't have a great way to do this when launching the application with
bazel run
. As a workaround the developer can invoke bazel run like this:but it feels like we should automatically honor package level files like:
When working on this, remember to support profile specific prop files: https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config.files.profile-specific
The text was updated successfully, but these errors were encountered: