0

I have a Spring boot application(Gradle) with main class as:

@EnableEurekaClient
public class UserServiceApplication  extends WebMvcConfigurer{

What this annotation does is enable this application as Discovery Service client(Eureka in this case) but I don't want this to be enabled in local environment as I don't want to set registry for my local environment. So the question is, how can I make sure this annotation is used only in non-local environments?

Sachin Verma
  • 3,712
  • 10
  • 41
  • 74
  • When run in local environment just comment //@EnableDiscoveryClient. Then discovery will not work – Anupam Biswas Apr 11 '18 at 12:04
  • @AnupamBiswas, it still has eureka client dependency , that keep on throwing exceptions of not found. Any idea how can I disable that? May be add profile based dependencies, is that a thing? – Sachin Verma Apr 11 '18 at 12:06
  • add `eureka.client.enabled=false` to your `application.properties`. Create a profile for production or your live system to enable it. – M. Deinum Apr 11 '18 at 12:09
  • Please see the the linked thread this answers exactly what you are trying. – Darren Forsythe Apr 11 '18 at 12:09

0 Answers0