1.applicaiton.yml配置文件
spring:
application:
name: springboot-rabbitmq
rabbitmq:
enabled: false
host: xxx.xxx.xxx.xxx
port: xxx
username: xxxx
password: xxxxxxx
2.测试代码
@Configuration
@ConditionalOnProperty(prefix = "spring.rabbitmq", name = "enabled", havingValue = "true")
public class DirectRabbitConfig {
}
@Component
@ConditionalOnProperty(prefix = "spring.rabbitmq", name = "enabled", havingValue = "true")
public class DirectReceiver {
}