Spring boot for Microservices with Eureka Client Configuration
Eureka Server is an application that holds the information about all client-service applications.
Every Micro 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.
Create Eureka Server: Project Name is ureka-server
Create ServletInitializer.java class and extends SpringBootServletInitializer
Create ServletInitializer.java class and extends SpringBootServletInitializer
Check Main Class is Name of UrekaServerApplication to add Annotations
Create application.properties
server.port=8761
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
Create pom.xml
Write Click to Project Node and Run as Spring Boot App
Output check on Browser to write URL http://localhost:8761/
How to Building a client Service
We have to create Two client Service are name Demo and demo-u2
We have to create Two client Service are name Demo and demo-u2
Create Demo API:
Create Controller Class is Name of BaseController add add Annotations
Check Main Class is Name of DemoApplication and add Annotations
Create application.properties
server.port=8081
spring.application.name=client-service-1
eureka.client.serviceUrl.defaultZone=http://127.0.0.1:8761/eureka
Create pom.xml
Write Click to Project Node Demo and Run as Spring Boot App
Reload the browser and check Instances currently registered with Eureka.
Similarly you can create dem-u2 client API, if there is nay problem then you can watch the video Link:.
Subscribe to:
Posts
(
Atom
)