Create a Git repository for your configuration files
- Create a new module: config
Use as an empty folder
-
Copy the application.yml of project 2,3,4,11 into the config directory and rename it
- item-service-dev.yml
- user-service-dev.yml
- order-service-dev.yml
- zuul-service-dev.yml
Spring is added in the dev. Yml. Cloud. Config. Override - none: true
- The submission is pushed to the remote repository
- Finally, clear out the four items
application.yml
file
“Dev” is the name of the profile. It can be written dev /test /prod.
Build the config server of the configuration center
The config config center downloads all configuration files from the Git repository, while other microservices are obtained from the config config center
- Create the config configuration center project
- Add config server/eureka client dependency
- Configuration application. Yml: application name/git. Uri: configuration warehouse path/git. SearchPaths: config/server port/eureka defaultZone
- Startup class adds annotations:
@EnableConfigServer
Configure the client of the center
Modify items 2,3,4,11
- Add a Config Client dependency
- New configuration file
bootstrap.yml
Yml Bootstrap. yml performs a boot (initialization) operation when the SpringBoot project starts before loading Application.yml
-
configuration
- eureka
- Configure the service ID of the center
- Which configuration file to download