【问题标题】:CommandLineRunner VS SmartLifecycleCommandLineRunner VS SmartLifecycle
【发布时间】:2018-05-14 16:29:34
【问题描述】:

使用@PostConstruct 并自动装配MessageChannel 问题,我找到了解决方案SmartLifecycle.start()

也可以使用CommandLineRunner吗?

在完全初始化上下文后开始使用MessageChannel rabbitMQ 的最佳方式是什么?

【问题讨论】:

    标签: spring-boot rabbitmq spring-cloud-stream


    【解决方案1】:

    Spring Boot 的 CommandLineRunner(或 ApplicationRunner)很好。

    SmartLifecycle 可用于任何 Spring 应用程序,而不仅仅是 Boot 应用程序。

    【讨论】: