Build a micro-service framework and test environment-2-registry
It should have been based on the logic of what-how-why. However, in order to show you the actual and obvious effect, the registration center is specially put forward.
1. Eureka server example
(1) create a project using Fileholders Newspeak Spring Starter Project, and follow the wizard to select Eureka Server:
(2) check dependencies:
Eureka Server dependencies:
Spring Cloud management dependencies:
Warehouse:
(2) Construction of registry
Just add the annotation @ EnableEurekaServer
II. Eureka client example
(1) create a project using Fileholders Newspeak Spring Starter Project, and follow the wizard to select Eureka Discovery:
(2) check dependencies:
Eureka Discovery dependencies:
Also web depends on:
Spring Cloud management dependencies:
Warehouse:
(2) client service construction
Just add the annotation @ EnableDiscoveryClient.
It also provides RESTful-based WebService, using the annotation @ RestController.
In order for the registry to recognize the service name, you need to specify an ApplicationName in the bootstrap.properties file:
After starting the registry and client services, use the Chrome test:
The effect has been seen, and then let's start with a full set of SPA services from scratch.