@Value和@ConfigurationProperties

1.@Value用法

https://blog.csdn.net/u010832551/article/details/73826914

2.@ConfigurationProperties用法

https://www.jianshu.com/p/7f75936b573b

3.最近看到的一个新的用法:

@Bean("kafakConsumerProp")
@ConfigurationProperties(prefix="kafka.consumer.properties")
public Properties getKafkaConsumerProperties() {
return new Properties();
}

直接注入进Properties对象

猜你喜欢

转载自www.cnblogs.com/muxi0407/p/11773209.html