Fix property source ordering issue with bootstrap context

The problem is that the bootstrap context gets created first
with the correct wiremock server port, and then the environment
is merged into the main context before the annotation
property source is created, so the latter takes precedence.
Fixed by re-ordering the property sources if detected.

Also switch off bootstrap context for wiremock server

Fixes gh-225
This commit is contained in:
Dave Syer
2017-03-24 09:24:28 +00:00
parent fd04629f8f
commit c1e285e76f
4 changed files with 40 additions and 15 deletions

View File

@@ -4,3 +4,4 @@ target/
.gradle
build/
/.apt_generated/

View File

@@ -21,6 +21,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<spring-cloud-contract.version>1.0.5.BUILD-SNAPSHOT</spring-cloud-contract.version>
<spring-cloud-commons.version>1.1.8.RELEASE</spring-cloud-commons.version>
</properties>
<dependencies>
@@ -32,6 +33,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter</artifactId>
</dependency>
<!-- tag::stub_runner[] -->
<dependency>
@@ -79,6 +84,13 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons-dependencies</artifactId>
<version>${spring-cloud-commons.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<!-- end::contract_bom[] -->