Spring-boot default profile for integration tests

后端 未结 11 1072
说谎
说谎 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:57

    If you use maven, you can add this in pom.xml:

    
        
            
                org.apache.maven.plugins
                maven-failsafe-plugin
                
                    -Dspring.profiles.active=test
                
            
            ...
    

    Then, maven should run your integration tests (*IT.java) using this arugument, and also IntelliJ will start with this profile activated - so you can then specify all properties inside

    application-test.yml
    

    and you should not need "-default" properties.

提交回复
热议问题