Get the App
SLTechnology News&Howtos  ›  Development  › 

How to configure springcloud configuration Center native

Shulou Source: shulou.com Published: 2022-06-03 10:02:42 11月15日 Update

This article will explain in detail how to configure the springcloud configuration center native. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Spring cloud configuration center native configuration 1, pom file add dependency org.springframework.cloud spring-cloud-config-server2, configuration file application.properties configure local path # tomcat port number server.port=8001# configuration file in the local spring.profiles.active=native# configuration file directory spring.cloud.config.server.native.search-locations=D:/workspace/GitHub/spring-config/config-file3, The main program opens @ EnableConfigServer annotation @ EnableConfigServer@SpringBootApplicationpublic class ConfigApplication {public static void main (String [] args) {SpringApplication.run (ConfigApplication.class) Args) }} spring config server uses native

Using spring cloud's config server, store a default configuration file in config server, which is located in the resouces of the application and located in resource/shared, and will be released with the config server package.

In the location where a file system is appended, custom configuration information can be stored in this location. After the system is deployed, the custom configuration file config server provides configuration service yml files in the agreed folder, in which application.yml will provide configuration parameters to all config client and then there is a specific application configuration file appname.yml. Each system has two configuration files, plus two configuration file storage locations.

Therefore, the configuration file of a system will load four yml files and among the four yml configuration files, the configuration files with high priority will overwrite the configuration files with low priority. If the client of config is park-auth, the corresponding configuration files are (configuration items arranged from high priority to low priority):

Native configuration of / var/park/conf/park-auth.ymlclasspath:/shared/park-auth.yml/var/park/conf/application.ymlclasspath:/shared/application.ymlconfig server

The high priority configuration is as follows: cloud: config: server: native: search-locations:-classpath:/shared-/ var/park/conf

This is the end of this article on "how to configure springcloud configuration Center native". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Tags: Configuration file priority location system article two more good practical main program information content parameters slogan available in folder article comment directory Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker macOS Linux Huawei MariaDB