AutoConfigureStubRunner引发的AbstractMethodError

时间:2019-05-31 16:21:38

标签: spring spring-cloud-contract spring-config

我正在使用Spring Cloud Contract在我们的系统中测试消息传递合同。我已经在生产者端创建了合同,生成了存根,并验证了生成的测试是否按预期通过了。但是,当我尝试在用户端设置相关测试时,出现了AbstractMethodError,这似乎是由AutoConfigureStubRunner批注引起的。

pom.xml依赖项

...
<properties>
   <spring-cloud-services-dependencies.version>1.5.0.RELEASE</spring-cloud-services-dependencies.version>
</properties>
...
<dependencyManagement>
   <dependencies>
      <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-contract-stub-runner</artifactId>
            <scope>test</scope>
            <version>${spring-cloud-contract.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-contract-stub-runner</artifactId>
            <scope>test</scope>
            <version>${spring-cloud-contract.version}</version>
        </dependency>
   </dependencies>
</dependencyManagement>
...

消费者端测试类签名

@RunWith(SpringRunner.class)
@SpringBootTest(classes = {ConsumerApplicationRunner.class})
@AutoConfigureStubRunner(stubsMode = StubRunnerProperties.StubsMode.LOCAL, ids = {"com.example:producer-artifact"}, consumerName = "consumer", stubsPerConsumer = true)
public class MessagingTest {

有什么想法吗?

0 个答案:

没有答案