Skip to content

Register Notification Service To Eureka Server

Piyush Chaudhari edited this page Aug 19, 2018 · 3 revisions

Go to notification-service and apply below change on build.gradle


ext {
springCloudVersion = 'Finchley.SR1'
}

dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}


Add below dependencies in your notification-service project.

compile('org.springframework.cloud:spring-cloud-starter-netflix-eureka-client') for service discovery

Refresh notification-service from eclipse or STS based on your development tools.

Set below property on application.properties

spring.application.name = notification-service

eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka
eureka.client.fetch-registry= true
eureka.instance.preferIpAddress=true
eureka.instance.leaseRenewalIntervalInSeconds=1
eureka.instance.leaseExpirationDurationInSeconds=2
ribbon.eureka.enabled=true

Go to mail class of notification-service NotificationServiceApplication.java and add @EnableDiscoveryClient annotation