Our registration center here is implemented using zookeeper clusters.
A Spring Boot Three-step docking ZK
The ZK client jar package is added to the 1.pom.xml file
2.Spring boot Launch class, add @enablediscoveryclient annotations
3. In the configuration file, specify the name of the microservices, ZK's connection information
Here, because we are using spring Cloud Config, in the configuration file, you only need to specify the name and Config address of the microservices, and other properties can be specified in the configuration file.
After using config, the name of the configuration file is: Bootstrap.properties (by default, the name of the configuration file is application.properties, after using config, Need to change the file name to Bootstrap.properties)
Without config, the name of the configuration file is: application.properties
Project, the contents of the Bootstrap.properties file are as follows:
On Git, the section of the configuration file for query is as follows: (Note that the file name here is: Order-test.properties, where Order is the name of the microservices, test is specified by profiles, so the same microservices, can have test, Prod,dev,local four configuration files)
How the Spring Boot project interfaces to the registry (ZooKeeper)