Spring-boot default profile for integration tests

后端 未结 11 1058
说谎
说谎 2020-12-07 14:49

Spring-boot utilizes Spring profiles (http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-profiles.html) which allow for instance to have separate co

11条回答
  •  既然无缘
    2020-12-07 14:53

    Add spring.profiles.active=tests in your application.properties file, you can add multiple properties file in your spring boot application like application-stage.properties, application-prod.properties, etc. And you can specify in your application.properties file while file to refer by adding spring.profiles.active=stage or spring.profiles.active=prod

    you can also pass the profile at the time running the spring boot application by providing the command:

    java -jar-Dspring.profiles.active=localbuild/libs/turtle-rnr-0.0.1-SNAPSHOT.jar

    According to the profile name the properties file is picked up, in the above case passing profile local consider the application-local.properties file

提交回复
热议问题