类型EnableBinding已弃用,类型StreamListener已弃用-Spring Cloud Stream
我正在使用SpringBootVersion2.4.2,并使用类型EnableBinding已弃用,类型StreamListener已弃用-Spring Cloud Stream,spring,spring-cloud-stream,Spring,Spring Cloud Stream,我正在使用SpringBootVersion2.4.2,并使用@InboundChannelAdapter进行SpringCloud流和Spring集成 import org.springframework.cloud.stream.annotation.EnableBinding; import org.springframework.cloud.stream.messaging.Source; import org.springframework.integration.annotation
@InboundChannelAdapter
进行SpringCloud流和Spring集成
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.integration.annotation.InboundChannelAdapter;
@EnableBinding(value = Source.class)
public class TransactionPublisher {
@InboundChannelAdapter(channel = Source.OUTPUT)
public String sendTransactionDetails() {
return "{name:\"T1\", amount: \"1000\", transactionFor : \"Purchase\"}";
}
}
RabbitmqReceiverApplication.java
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
@EnableBinding(value = Sink.class)
@SpringBootApplication
public class RabbitmqReceiverApplication {
public static void main(String[] args) {
SpringApplication.run(RabbitmqReceiverApplication.class, args);
}
@StreamListener(Sink.INPUT)
public void log(String message) {
System.out.println(message);
}
}
替代方案是什么?那么如何重构上述代码呢?随着节奏的加快,很多事情都在发生,很难理解会发生什么和会发生什么?请参见
e、 在消费者方面
@Bean
消费者日志(){
返回str->{
系统输出打印项次(str);
};
}
绑定名称为登录-0
在生产者方面,它是一个绑定名为sendTransactionDetails-out-0的Supplier
bean