How to selectively disable Eureka discovery client with Spring?

前端 未结 6 1416
一整个雨季
一整个雨季 2020-12-09 03:12

Is there a way to disable spring-boot eureka client registration based on the spring profile?

Currently I use the following annotations:

@Configurati         


        
6条回答
  •  猫巷女王i
    2020-12-09 03:55

    With the latest version of Spring Cloud Finchley.SR2 if you are using the annotation @EnableDiscoveryClient you have to set all of the following properties in application.properties to disable the service registration:

    spring.cloud.service-registry.auto-registration.enabled=false
    eureka.client.enabled=false
    eureka.client.serviceUrl.registerWithEureka=false
    

提交回复
热议问题