Build a micro-service framework and test environment-10-configuration center
1 instance
(1) create a server
Create a project using the Filekeeper Newspeak Spring Starter Project and follow the wizard to select config server.
Use the annotation @ EnableConfigServer, as follows:
Modify application.properties:
(2) create a client
Create a project using Fileholders Newspeak Spring Starter Project, and follow the wizard to select config server, web.
Create a controller class and add comments as follows:
Add profile bootstrap.properties:
Modify application.properties:
(3) start and test
Start two services in Boot Dashboard.
Enter the test in the browser:
Because the directory desktop/config is not established in the git library, the solution is to see the C problem below and use the remote repository instead.
Modify the a-bootiful-client.properties file of the remote warehouse to:
Test results:
Further processing is needed at this point to add dependencies to the client project:
Restart the client service and execute on the command line:
If the system does not recognize curl, install the curl tool.
Test client again:
The test was successful.
(4) question:
A. Unable to start client
The reason is that you forgot to select web when you created the project, and the solution is to increase your dependency on spring-boot-starter-web in order to start tomcat:
B 、 No such label: master
Special settings are required to use master branches and other branches
C, Cannot clone or checkout repository: http://localhost:8000/scm/git/config
First, modify the server's application.properties:
Then, store the a-bootiful-client.properties file in the local master branch root directory.
Finally, upload the master remotely to the git server, as instructed in "3.14.3 synchronizing files to the remote repository".
D 、 Cannot load environment
Git status is wrong, restart PC