我无法使用以下代码。我收到以下错误 在HelloController类中找不到带限定符“messages”的bean。
我有以下依赖
package com.example.scs.demoscs;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoScsApplication {
public static void main(String[] args) {
SpringApplication.run(DemoScsApplication.class, args);
}
}
package com.example.scs.demoscs;
import org.springframework.cloud.stream.annotation.Output;
import org.springframework.messaging.MessageChannel;
public interface DemoMessages {
@Output("messages")
MessageChannel messages();
}
package com.example.scs.demoscs;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.context.annotation.Configuration;
@Configuration
@EnableBinding(DemoMessages.class)
public class ChannelConfiguration {
}
package com.example.scs.demoscs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.messaging.MessageChannel;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController()
public class HelloController {
private MessageChannel output;
@Autowired
public HelloController(@Qualifier("messages") MessageChannel output) {
this.output = output;
}
@GetMapping("/hello")
public String SayHello(){
return "Hello";
}
}