Spring integration tests with profile

前端 未结 5 1821
温柔的废话
温柔的废话 2020-12-07 21:40

In our Spring web applications, we use the Spring bean profiles to differentiate three scenarios: development, integration, and production. We use them to connect to differe

5条回答
  •  粉色の甜心
    2020-12-07 21:54

    If you want to avoid hard-coding the profile you may want to use the system property spring.profiles.active and set it to whatever you need in that particular environment e.g. we have "dev", "stage" and "prod" profiles for our different environments; also we have a "test", "test-local" and "test-server" profiles for our testing.

    Remember that you can have more than one profile in that system property by using a list of comma-separated values e.g. "test,test-qa".

    You can specify system properties in a maven project in the maven surefire plugin or passing them like this:

    mvn -DargLine="-DpropertyName=propertyValue"
    

提交回复
热议问题