Is there a way to disable spring-boot eureka client registration based on the spring profile?
Currently I use the following annotations:
@Configuration
@EnableAutoConfiguration
@EnableDiscoveryClient
@EnableConfigServer
public class ConfigApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigApplication.class, args);
}
}
What I need is either a conditional such as (excuse the pseudo code)
@if (Profile!="development")
@EnableDiscoveryClient
@endif
Or some way in the application properties file. I have tried setting application.yml file as:
spring:
profiles: development
cloud:
discovery:
enabled: false
But this did not work.
@Profile("!development")
– Shipping