0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Springの配列の環境変数を外から投入する

Posted at

環境変数でconfを上書きする

やり方次第だとは思いますが、spring batchでバッチをつくった際、ジョブスケジューラ側で変数をハンドリングした方が楽なケースもあると思います。
Springの説明 記載の通り、spring.config.nameを、SPRING_CONFIG_NAMEで書き換えられるのです。
(設定ファイルから環境変数を参照するのではなく、上書きです)

が、配列をどういれるのかわからなかったので、メモしておきます。

application.yml

hoge:
  fuga:
    - a
    - b
    - c

これを上書きするには、

exec.sh
export HOGE_FUGA_0=a
export HOGE_FUGA_1=b
export HOGE_FUGA_2=c

なるほど。。。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?