7
7

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.

gradleでのjava起動オプションの設定

Last updated at Posted at 2016-10-31

#gradleでのjava起動オプションの設定
jvmArgsに値を設定することでjava起動オプションが反映される。

build.gradle
jvmArgs = ['-Dspring.profiles.active=test']

#gradle経由でspringテスト実行時のapplication.propertiesを切り替える
以下のように設定することでテスト実行時のプロパティファイルを
application.propertiesからapplication-test.propertiesに切り替えることが可能。

build.gradle
test {
  // テスト用プロパティファイルの読み込み(application-test.properties)
  jvmArgs = ['-Dspring.profiles.active=test'] 
}

#参考サイト
application.propertiesの切替方法や読込順に関しては
以下のサイトが非常に詳しく記載してあって分かりやすいです。

Spring Bootの外部設定値の扱い方を理解する

7
7
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
7
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?