当前位置:网站首页>NACOS Configuration Center Settings Profile
NACOS Configuration Center Settings Profile
2022-08-05 06:45:00 【User Nickname 23】
Add a new configuration in the nacos configuration center
After logging in to nacos, click the plus sign in the configuration list
Edit configuration information submission
Note the naming rules of Data ID
${prefix}-${spring.profile.active}.${file-extension}- The prefix defaults to the value of spring.application.name of the project configuration (ie: nacos-provider),It can also be configured through the configuration item spring.cloud.nacos.config.prefix.- spring.profiles.active=dev is the profile corresponding to the current environment.Note: When spring.profiles.active is empty,The corresponding connector - will also not exist, and the concatenation format of dataId becomes ${prefix}.${file-extension}- file-exetension is the data format of the configuration content, which can be configured through the configuration item spring.cloud.nacos.config.fileextension.Currently only properties and yaml types are supported.
Select the corresponding suffix according to your local configuration file type
Paste the corresponding configuration information and click Publish
The loading order of the springboot configuration file
This mainly describes the loading order of application and bootstrap.
bootstrap.yml (bootstrap.properties) loads
application.yml (application.properties) first
bootstrap.yml is used for the bootstrap phase of the application context.
bootstrap.yml is loaded by the parent Spring ApplicationContext.The parent ApplicationContext is loaded before using application.yml.
(2) Configuration difference Both bootstrap.yml and application.yml can be used to configure parameters.
bootstrap.yml can be understood as some parameter configurations at the system level, these parameters generally do not change.
application.yml can be used to define application level.
We use the bootstrap.yml configuration file in our project
#Configuration center addressspring:cloud:nacos:config:server-addr: 127.0.0.1:8848#spring.profiles.active=dev# This configuration affects the dataId in the unified configuration centerapplication:name:service-statistics# Namespaces#spring.cloud.nacos.config.namespace=8c7d4e34-09df-405f-a351-50fa42285a7f
Note that if bootstrap.yml is used locally, the configuration file in nacos must also be of the type yml or it will not be loaded. Similarly, if it is bootstrap.properties, the configuration file in nacos must also be properties or it will not be loaded.Load to, according to the suffix of dataId and the selection in the new configuration
Let me introduce myself first. The editor graduated from Shanghai Jiaotong University in 2013. I worked in a small company and went to big factories such as Huawei and OPPO. I joined Alibaba in 2018, until now.I know that most junior and intermediate java engineers want to upgrade their skills, they often need to explore their own growth or sign up to study, but for training institutions, the tuition fee is nearly 10,000 yuan, which is really stressful.Self-learning that is not systematic is very inefficient and lengthy, and it is easy to hit the ceiling and the technology stops.Therefore, I collected a "full set of learning materials for java development" for everyone. The original intention is also very simple. I hope to help friends who want to learn by themselves but don't know where to start, and at the same time reduce everyone's burden.Add the business card below to get a full set of learning materials
边栏推荐
猜你喜欢
el-autocomplete use
【FAQ】CCAPI兼容EOS相机列表(2022年8月 更新)
Cocos Creator Mini Game Case "Stick Soldier"
DevOps process demo (practical record)
Nacos集群的搭建过程详解
Wireshark packet capture and common filtering methods
el-progress implements different colors of the progress bar
Mina's long and short connections
el-autocomplete使用
VLAN is introduced with the experiment
随机推荐
unity 将Text批量替换为TextMeshProUGUI
The method of using ROS1 bag under ROS2
config.js related configuration summary
程序员应该这样理解I/O
selenium learning
The size of the screen adaptation
Four ways to obtain Class objects through reflection
Wireshark packet capture and common filtering methods
LeetCode练习及自己理解记录(1)
Chengyun Technology was invited to attend the 2022 Alibaba Cloud Partner Conference and won the "Gathering Strength and Going Far" Award
Shadowless Cloud Desktop
[issue resolved] - jenkins pipeline checkout timeout
Transformer详细解读与预测实例记录
Into the pre-service, thought they play so flowers
【FAQ】CCAPI兼容EOS相机列表(2022年8月 更新)
大小屏适配
Problems encountered in installing Yolo3 target detection module in Autoware
LeetCode中常用语言的一些基本方法记录
LaTeX image captioning text column automatic line wrapping
Introduction to Network Layer Protocols