Monday, November 5, 2018

Spring Boot override Bootstrap properties

1. Bootstrap properties file is inside the packaged jar


This is not a useful case to manage the bootstrap properties or application properties, the reason is you have to rebuild your application again if made any change to the properties

You should have properties file name following the format bootstrap-{profile}.yml ( or .properties variants)


2. Bootstrap properties is outside of the packaged jar.


I prefer this case to manage properties, we don’t need to rebuild the application again if we made change to properties also we can manage our properties better with VCS like git.

Let assume that we have a configuration file outside of packaged jar.

In order to load the file, we need to change the bootstrap properties location by override the spring.cloud.bootstrap.location attribute.



With this approach we can easily override the bootstrap properties.

No comments:

Post a Comment