Fixed the build
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
package org.springframework.cloud.contract.verifier.messaging.stream;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
@@ -40,7 +39,6 @@ import org.springframework.util.Assert;
|
||||
@ConditionalOnClass({ EnableBinding.class, MessageCollector.class })
|
||||
@ConditionalOnProperty(name = "stubrunner.stream.enabled", havingValue = "true", matchIfMissing = true)
|
||||
@AutoConfigureBefore(NoOpContractVerifierAutoConfiguration.class)
|
||||
@ConditionalOnBean(MessageCollector.class)
|
||||
public class ContractVerifierStreamAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -47,13 +47,12 @@ public class StreamStubMessages implements MessageVerifier<Message<?>> {
|
||||
|
||||
private final ApplicationContext context;
|
||||
|
||||
private final MessageCollector messageCollector;
|
||||
private MessageCollector messageCollector;
|
||||
|
||||
private final ContractVerifierStreamMessageBuilder builder = new ContractVerifierStreamMessageBuilder();
|
||||
|
||||
public StreamStubMessages(ApplicationContext context) {
|
||||
this.context = context;
|
||||
this.messageCollector = context.getBean(MessageCollector.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,8 +81,7 @@ public class StreamStubMessages implements MessageVerifier<Message<?>> {
|
||||
MessageChannel messageChannel = this.context.getBean(
|
||||
resolvedDestination(destination, DefaultChannels.INPUT),
|
||||
MessageChannel.class);
|
||||
return this.messageCollector.forChannel(messageChannel).poll(timeout,
|
||||
timeUnit);
|
||||
return messageCollector().forChannel(messageChannel).poll(timeout, timeUnit);
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.error("Exception occurred while trying to read a message from "
|
||||
@@ -146,4 +144,11 @@ public class StreamStubMessages implements MessageVerifier<Message<?>> {
|
||||
return receive(destination, 5, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
private MessageCollector messageCollector() {
|
||||
if (this.messageCollector == null) {
|
||||
this.messageCollector = context.getBean(MessageCollector.class);
|
||||
}
|
||||
return this.messageCollector;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user