springboot中使用@Value读取配置文件

首先看我的application-dev.yml配置文件

 在Service层我想用到zookeeper的连接地址,

直接定义变量使用@Value读取地址就可以了。具体引入可以看如下截图:

猜你喜欢

转载自blog.csdn.net/qq_36189144/article/details/86612209