What does Spring cloud produce?
According to this introduction of the official website, we can know that Spring cloud is a tool for developers, and the use of this tool is to help developers quickly develop a more general distributed system .
(while tools include: Configuration management, service discovery, circuit breakers, routing, Micro Proxies, control bus, one-time tokens, global locks, leading elections, distributed sessions, cluster status)
What is Spring boot based on?
This shows thatSpring Cloud was developed based on spring boot .
Today we are mainly looking at the configuration and use of the service registry.
There may be a point to be mentioned here, that is, the previous service registration and discovery code does not support Spring Boot 2.0. More than 0 of the version, but now it is supported, the main explanation here today is based on the 2.0.1
We say Spring cloud is a big tool, and every small module inside it is a gadget, and the service finds that it uses Netflix Eureka
How to get started?
First we go to the official website to download the spring Cloud's basic code package
Because we see that we are setting up Eureka Server, the annotations we need to use are @enableeurekaserver
But this is not so smooth, because the build.gradle of the official website does not introduce the server dependence
And where we're going to introduce it, where do we find it? Take a look at the following pictures
In this, we can copy this sentence from the dependencies,
Compile ' org.springframework.cloud:spring-cloud-starter-eureka-server'
And then rebuild the project, and that's when idea doesn't report red.
After that, we also need to configure the following information in our Yml file
Note: Both Registerwitheureka and Fetchregistry must be configured to be false
This time we enter your configured IP in the Address bar: port to access, you will see the following page
To this Eureka server has been configured successfully
Registration and Discovery Service registry for Spring cloud-Services (Eureka Server)