java - configure maven profiles in spring boot @activeprofile annotation -


i have been reading lot , can't find solution tells me how inlucde maven profiles in @activeprofiles annotation . possible or not?

the issue trying solve h2 , flyway start before tests execute not happening. configuration decscribed in maven profiles in pom.xml. when tests run in teamcity picks maven profile , execute standalone can't find configuration h2 , flyway , fail on starting.

... can't find solution tells me how inlucde maven profiles in @activeprofiles annotation.

do mean active spring profiles based on maven profile, if so, can configure in pom.xml:

<profiles>   <profile>     <id>mvnprofile</id>     <properties>       <spring.profiles.active>springprofile</spring.profiles.active>     </properties>     <dependencies>       <dependency>       </dependency>      </dependencies>   </profile>   ... </profiles> 

in test class configure profiles should run on ..

@runwith(..) @springapplicationconfiguration(...) @activeprofiles("springprofile") public class yourtest { ... } 

for profile specific properties, create application-springprofile.properties in addition application.properties, spring boot first load application.properties load application-springprofile.properties -- overriding properties configured application.properties.

finally, set maven profile -p flag

$mvn test -p mvnprofile  

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -