Spring Boot Application Configured As Eureka Server
Posted By : Deepak Maurya | 10-Sep-2020
In Microservice architecture eureka server is an application that holds the information about all client-service applications. In microservice each service will register into the Eureka server and Eureka server knows all the client applications running on each port and IP address. Eureka Server is also known as Discovery Server.
Let's start coding.
Add Eureka server dependency
Add all dependencies and artifacts in pom.xml file
Add Main Class for Eureka server
@EnableEurekaServer annotation , This annotation is used to make your Spring Boot application acts as a Eureka Server. In Eureka server all other Microservices can register themselves by using service URL.
Add aplication.properties file
- spring.application.name: This property has been added to define a unique name for your application.
- server.port: eureka server running at 10062 port
- eureka.client.fetch-registry: Registry Service doesn't register itself in eureka server.
- eureka.client.register-with-eureka : this property is determines service register itself as a client in eureka server.
I hope this post helps you understand about Eureka.There is a lot to learn. I only covered the basics in this post. In this post we implemented Eureka server as Discovery Server. each service will register into the Eureka server.Eureka server knows all the services host and port.
I plan to write more posts on the Microservices, focusing on more complex features.