当前位置:网站首页>Nacos common configuration
Nacos common configuration
2022-07-03 21:22:00 【Wh 789】
In this article Nacos Common configuration
List of articles
BootStrap and Application The difference between configuration files
BootStrap and Application The difference between configuration files
- Connect nacos The distributed configuration center must adopt bootstrap Form priority loading Otherwise you may report an error .bootstrap.yml The highest priority , It is the boot phase of the application context .bootstrap.yml By father Spring ApplicationContext load . our application Configuration form belongs to Spring Context .
- The registry is built for long polling , But the configuration center is not long polling , Add... To the configuration file @RefreshScope Annotations can be refreshed dynamically , Otherwise, the local configuration cache will not be refreshed automatically .
nacos Common configuration
nacos Common configuration
- dataId The configuration to be configured is consistent with the service name
- Multi environment configuration can be set
frequently-used yml File configuration information
spring:
application:
name: nacos-ccc
cloud:
nacos:
#### Registry connection address
discovery:
server-addr: 10.211.55.16:8848
#### Configure the connection address of the center
enabled: true
config:
server-addr: 10.211.55.16:8848
group: DEFAULT_GROUP
### Extension type of configuration file
file-extension: properties
### Enable multiple environments
profiles:
active: pro
server:
port: 8888
JAVA Core code
@RestController
@SpringBootApplication
// Configuration changes , adopt @RefreshScope Annotations can refresh local cache information in real time
@RefreshScope
public class NacosController {
// The use is consistent with the use of ordinary resource files
@Value("${ttt.name}")
private String userName;
@RequestMapping("/getConfig")
public String getConfig() {
return userName;
}
public static void main(String[] args) {
SpringApplication.run(NacosController.class);
}
}
This paper summarizes
This paper introduces nocas Common configuration information in .
边栏推荐
- Is flush account opening and registration safe and reliable? Is there any risk?
- Transformer structure analysis and the principle of blocks in it
- Compilation Principle -- syntax analysis
- [gd32l233c-start] 5. FLASH read / write - use internal flash to store data
- Solve the problem that openocd fails to burn STM32 and cannot connect through SWD
- treevalue——Master Nested Data Like Tensor
- Reinforcement learning - learning notes 1 | basic concepts
- Quickly distinguish slices and arrays
- Idea shortcut word operation
- Solve the problem that openocd fails to burn STM32 and cannot connect through SWD
猜你喜欢
The "boss management manual" that is wildly spread all over the network (turn)
2022 melting welding and thermal cutting examination materials and free melting welding and thermal cutting examination questions
MySQL——数据库备份
9 pyqt5 qscrollarea scroll area and qscrollbar scroll bar
Hcie security Day11: preliminarily learn the concepts of firewall dual machine hot standby and vgmp
90 后,辞职创业,说要卷死云数据库
90 後,辭職創業,說要卷死雲數據庫
设计电商秒杀系统
Operate BOM objects (key)
Getting started with postman -- environment variables and global variables
随机推荐
What is the maximum number of concurrent TCP connections for a server? 65535?
Inventory 2021 | yunyuansheng embracing the road
Qt6 QML Book/Qt Quick 3D/基础知识
浅议.NET遗留应用改造
Après 90 ans, j'ai démissionné pour démarrer une entreprise et j'ai dit que j'allais détruire la base de données Cloud.
Ask and answer: dispel your doubts about the virtual function mechanism
仿网易云音乐小程序
jvm jni 及 pvm pybind11 大批量数据传输及优化
Global and Chinese market of wall mounted kiosks 2022-2028: Research Report on technology, participants, trends, market size and share
MySQL——规范数据库设计
The 12th Blue Bridge Cup
How to choose cache read / write strategies in different business scenarios?
Etcd 基于Raft的一致性保证
Etcd raft Based Consistency assurance
Gee calculated area
Day 9 HomeWrok-ClassHierarchyAnalysis
Advanced technology management - how to examine candidates in the interview and increase the entry probability
请教大家一个问题,用人用过flink sql的异步io关联MySQL中的维表吗?我按照官网设置了各种
抓包整理外篇——————autoResponder、composer 、statistics [ 三]
MySQL - database backup