クラスパスとかファイル指定とかでプロパティファイルを読み込むやり方。リファレンスの Spring Cloud Config - File System Backendに書いてある。ちょっとしたテストをやるには手軽で良い。
ソースコード
Server
まず、server側のプロパティファイルにspring.profiles.active=native
と指定する。
次に、プロパティファイルはデフォルトでは以下に配置する。なので\src\main\resources
に配置すれば読み込んでくれる。
classpath:/
classpath:/config
file:./
file:./config
プロパティファイル配置場所を任意のディレクトリに変更したい場合spring.cloud.config.server.native.searchLocations
を使用する。以下はwindowsでC:\configtest
を指定した例。
spring.cloud.config.server.native.searchLocations=file:///C:/configtest/