Service registry in microservices

What you learn here about microservices

  • Service registry in microservices

Prerequisite: Please run Eureka naming server before running Eureka client(Service registry client).

Eureka naming server in microservices

Note:

Download below project instead creating new because if versions are different then you will get error in pom.xml

Please click on below link to download sample project for Service registry in microservices

Download Service registry in microservices sample project (12 downloads)

Service registry in microservices

Please follow the following steps to know how to create Service registry in microservices
1)First create simple maven project

2)Add eureka client, starter web and spring config dependency which is shown below

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
	<groupId>org.springframework.cloud</groupId>
	<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
	
<dependency>
	<groupId>org.springframework.cloud</groupId>
	<artifactId>spring-cloud-starter-config</artifactId>
</dependency>

eureka client dependency

3)Now add port number, application name and naming server configuration in application properties which is shown below

spring.application.name=eureka-client
server.port=8100
eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka

eureka client properties

4)Now please run the spring boot application

5)now go to browser and hit localhost:8761 url to see eureka dashboard which is shown below
service registry in spring boot

6)if you are able to see eureka client on eureka naming server dashboard means eureka client is registered successfully.

You may also like...