【发布时间】:2021-01-04 23:06:11
【问题描述】:
关于Spring Cloud合约的小问题。
我正在尝试为我的 Spring Actuator 健康端点编写一个基本合同。
这是一个带有 JUnit 5 Jupiter 5.7.0 的 Spring Webflux 2.4.1 项目,我是其中的服务器(我将执行器健康端点暴露给我的客户,因此,我想编写合同)。
因此,我导入了执行器 jar,以及合约验证器:
<artifactId>spring-boot-starter-actuator</artifactId>
<artifactId>spring-cloud-starter-contract-verifier</artifactId>
我刚刚在我的资源文件夹中写了一份简单的合同,删除了其他所有内容:
request:
method: GET
url: /actuator/health
headers:
Content-Type: application/json
response:
status: 200
运行 mvn clean install 时,我得到:
target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierTest.java:[3,17] cannot find symbol
symbol: class Test
location: package org.junit
target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierTest.java:[4,17] cannot find symbol
symbol: class Rule
location: package org.junit
target/generated-test-sources/contracts/org/springframework/cloud/contract/verifier/tests/ContractVerifierTest.java:[15,10] cannot find symbol
symbol: class Test
location: class org.springframework.cloud.contract.verifier.tests.ContractVerifierTest
请问根本原因是什么,如何解决?
谢谢
【问题讨论】:
标签: java spring-cloud-contract