Spring云契约-resolvedDestination中的NullPointerException
我正在尝试为SpringCloudStream创建SpringCloud合同。我有源、处理器和接收器。源使用SourcePollingChannelAdapte。contract groovy文件如下所示:Spring云契约-resolvedDestination中的NullPointerException,spring,spring-cloud-contract,Spring,Spring Cloud Contract,我正在尝试为SpringCloudStream创建SpringCloud合同。我有源、处理器和接收器。源使用SourcePollingChannelAdapte。contract groovy文件如下所示: package contracts.messaging import org.springframework.cloud.contract.spec.Contract Contract.make { description(""" Sends a non XhubJobStat
package contracts.messaging
import org.springframework.cloud.contract.spec.Contract
Contract.make {
description("""
Sends a non XhubJobState in Message
""")
// Label by means of which the output message can be triggered
label 'accpetable_message'
// input to the contract
input {
// the contract will be triggered by a method
triggeredBy('verifyValidXhubJobState()')
}
// output message of the contract
outputMessage {
// destination to which the output message will be sent
sentTo 'verifications'
// the body of the output message
body([
jobName:"Invalid_Destinations"
])
}
}
尝试执行maven安装时,我遇到异常:
"Exception took place while trying to resolve the destination. Will assume the name [verifications]
java.lang.NullPointerException: null
at org.springframework.cloud.contract.verifier.messaging.stream.StreamStubMessages.resolvedDestination(StreamStubMessages.java:89)......."
我在application.properties文件中定义了以下属性集
"spring.cloud.stream.bindings.output.destination= verifications"
我在配置中遗漏了什么吗?我没有看到您的代码,但我只能猜测您在基类中遗漏了这些注释-。您的上下文没有启动,所以字段没有被注入,这就是您获得NPE的原因。我没有看到您的代码,但我只能猜测,在基类中,您缺少这些注释-。您的上下文没有启动,因此字段没有被注入,这就是您获得NPE的原因。下面是我的MessageBase类:MessageBaseClass与BeerMessageBase.java非常相似,很抱歉,我看不到您粘贴的任何内容。请将您的代码上载到Github以下是我的MessageBase类:MessageBase类与BeerMessageBase.java非常相似,很抱歉,我看不到您粘贴的任何内容。请将您的代码上载到Github