@Value("${spring.rabbitmq.host}")
private static String host;
运行后发现注入失败。
解决方法:
给参数注入,执行set方法(这里注意set方法中的static要去掉)
@Value("${spring.rabbitmq.host}")
public void setHost(String host) {
ConnectionUtil.host = host;
}
@Value("${spring.rabbitmq.host}")
private static String host;
运行后发现注入失败。
解决方法:
给参数注入,执行set方法(这里注意set方法中的static要去掉)
@Value("${spring.rabbitmq.host}")
public void setHost(String host) {
ConnectionUtil.host = host;
}