In this short tutorial you will learn how to use SearchPaths to configure your Spring Cloud Config Server to discover properties files in a remote Git repository subdirectories.
To learn how to configure Spring Cloud Config Server and also Spring Cloud Config Client please read this tutorial:
By default Spring Cloud Config Server will look for property files in a root folder of your remote Git repository. You can use SearchPaths to specify which additional folders in a Git repository should be checked for property files. For example:
server.port=8012 spring.application.name=PhotoAppAPIConfigServer spring.cloud.config.server.git.uri = https://github.com/<YOUR USER GIT HUB NAME HERE>/<REPOSITORY NAME HERE> spring.cloud.config.server.git.username = spring.cloud.config.server.git.password = spring.cloud.config.server.git.clone-on-start=true spring.cloud.config.server.git.searchPaths: search-feature-properties, shopping-card*
- search-feature-properties – is a folder name which holds application.properties file with properties related to Search Feature,
- shopping-card* – will match all folders that begin with shopping-card prefix. This will make Spring Cloud Config Server to check folders like
You can thus have the following folder structure in your Git repository
/application.properties /search-feature-properties/application.properties /shopping-card-tv/application.properties
I hope this very short tutorial on how to use SearchPaths configuration property in Spring Cloud Config Server was helpful to you. Please check other Spring Cloud related tutorials on this site to learn more. And if you enjoy learning Spring Boot by watching a series of step by step video tutorials, please have a look at the below list of vide courses. One of them might greatly help you improve your RESTful Web Services developer skills.