当前位置:网站首页>Nacos Basics (5): getting started with Nacos configuration
Nacos Basics (5): getting started with Nacos configuration
2022-04-23 11:26:00 【There is no retreat when sailing against the current】
Preface
How to publish configurations ?nacos How the client gets the configuration ?
Section 1 Release configuration
- open nacos Console , Click on Configuration Management >> Configuration list , Click on + No. add configuration
- Fill in the configuration information , And publish , View the configuration list , The configuration content just appears .
In the second quarter nacos Client get configuration
-
newly build maven project
-
Introduce dependencies
<dependency>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-client</artifactId>
<version>1.3.2</version>
</dependency>
- To write java Code
package com.it2;
import com.alibaba.nacos.api.NacosFactory;
import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.exception.NacosException;
import java.util.Properties;
public class NacosDemo01 {
public static void main(String[] args) throws NacosException {
String dataId="nacos-demo.yaml";
String group="DEFAULT_GROUP";
String serverAddr="127.0.0.1:8848";
Properties properties=new Properties();
properties.put("serverAddr",serverAddr);
ConfigService configService= NacosFactory.createConfigService(properties);
String config=configService.getConfig(dataId,group,3000);
System.out.println(config);
}
}
- Run code , Then we can see the front nacos The content just configured in .
版权声明
本文为[There is no retreat when sailing against the current]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231117595202.html
边栏推荐
- 学习 Go 语言 0x01:从官网开始
- Canvas详解
- Prevent SQL injection in web projects
- 全网最细的短网址系统设计与实战
- Advanced file IO of system programming (13) -- IO multiplexing - Select
- 学习 Go 语言 0x04:《Go 语言之旅》中切片的练习题代码
- 博客文章导航(实时更新)
- redis优化系列(二)Redis主从原理、主从常用配置
- R-drop: a more powerful dropout regularization method
- MySQL sorting feature details
猜你喜欢
随机推荐
Learn go language 0x07: stringer exercise code in go language journey
Detailed explanation of MySQL creation stored procedure and function
实践数据湖iceberg 第三十课 mysql->iceberg,不同客户端有时区问题
学习 Go 语言 0x08:《Go 语言之旅》中 练习使用 error
MySQL sorting feature details
创客教育中的统筹方案管理模式
nacos基础(5):nacos配置入门
Write console script by laravel
用curl库压缩成发送字符串为utf8并用curl库发送
Explain in detail the pitfalls encountered in DTS due to the time zone problems of timestamp and datetime in MySQL
解读2022机器人教育产业分析报告
Laravel绑定钉钉群警报(php)
系统编程之高级文件IO(十三)——IO多路复用-select
Exploring the equipment and teaching of robot education
MySQL8.0升级的踩坑历险记
学习 Go 语言 0x02:对切片 Slice 的理解
进程间通信 -- 消息队列
Interpretation of 2022 robot education industry analysis report
My creation anniversary
解决 『SunCertPathBuilderException:unable to find valid certification path to requested target』 问题