当前位置:网站首页>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
边栏推荐
猜你喜欢
sql server duplicate values are counted after
disabledDate 日期选择器 datePicker
Transformer interprets and predicts instance records in detail
input detailed file upload
The use of three parameters of ref, out, and Params in Unity3D
VRRP overview and experiment
selenium learning
The 25 best free games on mobile in 2020
Collision, character controller, Cloth components (cloth), joints in the Unity physics engine
滚动条问题,未解决
随机推荐
LeetCode练习及自己理解记录(1)
ALC experiment
From "dual card dual standby" to "dual communication", vivo took the lead in promoting the implementation of the DSDA architecture
【FAQ】CCAPI兼容EOS相机列表(2022年8月 更新)
numpy.random使用文档
多行文本省略
By solving these three problems, the operation and maintenance efficiency will exceed 90% of the hospital
Billions of IT operations in the market, the product by strength to speak
The 25 best free games on mobile in 2020
数组&的运算
DevOps process demo (practical record)
config.js相关配置汇总
Media query, rem mobile terminal adaptation
el-autocomplete使用
[issue resolved] - jenkins pipeline checkout timeout
多线程之传递参数
Mina断线重连
DisabledDate date picker datePicker
input detailed file upload
docker部署完mysql无法连接