Reputation: 6612
I'm using several profiles for my app, that I can select via the application.yml prop:
spring.profiles.active: dev #can be integration, uat, prod
My applications all start by:
@SpringBootApplication
@EnableEurekaClient
public class MyApp {
}
Now, I'd like to enable the eureka client only for selected profiles. I don't want, for example, to enable that in dev profile as in dev you don't mind about the service register right?
Is it possible? I tried to move eureka related properties in the single profile files but they are found anyway...
Upvotes: 1
Views: 1115
Reputation: 6936
you can extract your config and only activate it on certain profiles
@Configuration
@Profile(value= {"uat","prod"})
@EnableEurekaClient
public class EurekaClientConfiguration {
//your configuration
}
on the other hand you could de-activate config for a certain profile by using a ! (=not) @Profile("!dev")
Upvotes: 4