Hands to build micro-services framework and test environments -2- registry

This should be based on what is - how do - how do logic. However, in order to let everyone look at the actual effect of the more obvious, especially the registration center in advance.

A, Eureka Server example

( 1 ) using the File à New à the Spring Starter Project to create a project, follow the wizard to select Eureka Server :

image.png

( 2 ) Check-dependent:

Eureka Server depend on:


image.png


Spring Cloud Management dependence:

image.png


warehouse:

image.png



( 2 ) Registration Center building

image.png


Increase in notes @EnableEurekaServer to



Two, Eureka Client Example

( 1 ) using the File à New à the Spring Starter Project to create a project, follow the wizard to select Eureka Discovery :

image.png


( 2 ) Check-dependent:

Eureka Discovery dependence:

image.png


Also web -dependent:

image.png


Spring Cloud Management dependence:

image.png


warehouse:

image.png


( 2 ) client service. Construction

image.png


Increase in notes @EnableDiscoveryClient can be.

Meanwhile-based RESTful of WebService , using annotations @RestController .

In order to identify the service name registry, you need to bootstrap.properties specify a file ApplicationName :

image.png


After starting the registration center and client service, use Chrome test:

image.png


Effects have been seen, behind or start from scratch to a full range of SPA services.

Guess you like

Origin blog.51cto.com/5526964/2403728