eureka discovery client - selective disable
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.
spring spring-boot netflix-eureka
add a comment |
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.
spring spring-boot netflix-eureka
Possible duplicate of Including bean definition when a profile is NOT active
– g00glen00b
Feb 2 '16 at 7:03
To use class in all cases excluding one profile, you can write@Profile("!development")
– dmitryvim
Oct 14 '16 at 8:10
add a comment |
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.
spring spring-boot netflix-eureka
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.
spring spring-boot netflix-eureka
spring spring-boot netflix-eureka
edited Apr 10 '17 at 0:02
Marek J
72461325
72461325
asked Feb 1 '16 at 23:01
zinc wombatzinc wombat
78116
78116
Possible duplicate of Including bean definition when a profile is NOT active
– g00glen00b
Feb 2 '16 at 7:03
To use class in all cases excluding one profile, you can write@Profile("!development")
– dmitryvim
Oct 14 '16 at 8:10
add a comment |
Possible duplicate of Including bean definition when a profile is NOT active
– g00glen00b
Feb 2 '16 at 7:03
To use class in all cases excluding one profile, you can write@Profile("!development")
– dmitryvim
Oct 14 '16 at 8:10
Possible duplicate of Including bean definition when a profile is NOT active
– g00glen00b
Feb 2 '16 at 7:03
Possible duplicate of Including bean definition when a profile is NOT active
– g00glen00b
Feb 2 '16 at 7:03
To use class in all cases excluding one profile, you can write
@Profile("!development")– dmitryvim
Oct 14 '16 at 8:10
To use class in all cases excluding one profile, you can write
@Profile("!development")– dmitryvim
Oct 14 '16 at 8:10
add a comment |
6 Answers
6
active
oldest
votes
Do it like this: create some @Configuration annotated class (class body can be omitted) ex.:
@Profile("!development")
@Configuration
@EnableDiscoveryClient
public class EurekaClientConfiguration
It means that this configuration file (and @EnableDiscoveryClient within) will be loaded in every profile except "developement".
Hope that helps,
Thanks that was what I was looking for
– zinc wombat
Feb 7 '16 at 0:50
Upvoting this because it's an awesome answer.
– ogradyjd
Nov 2 '16 at 17:21
People who use SO tend to copy code right away. Please fix "developement".wasted my whole hour.
– Sachin Verma
Apr 11 '18 at 13:32
Fixed, sorry for that. I know how big pain in the ass is looking for something like that.
– patrykos91
Apr 11 '18 at 22:01
add a comment |
You can disable eureka client in application.yml using this:
eureka:
client:
enabled: false
It's also for one profile
4
Please add explanations to your answer.
– Nikolay Mihaylov
Jun 16 '16 at 8:11
in application.yml or application.properties you can set spring variables in different profiles, as it was written in third question code sample. I just suggested to disable eureka this way
– dmitryvim
Oct 14 '16 at 8:09
add a comment |
Same issue here. You can simply put in your application property file the following configuration:
spring:
profiles: development
eureka:
instance:
hostname: localhost
client:
registerWithEureka: false
fetchRegistry: false
add a comment |
There is a standard boolean spring-cloud property
spring.cloud.discovery.enabled
This might be better than "eureka" specific since you might be using a different provider.
In my case this doesn't work buteureka.client.enabled: falsedoes.
– Lu55
Oct 8 '18 at 20:49
add a comment |
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
add a comment |
With the latest version of Spring boot, Please add this in the bootstrap.yml file
Spring cloud version : Edgeware: SR3 and above
spring:
application:
name: test
cloud:
service-registry:
auto-registration:
enabled: false
This will disable eureka. To enable it, we just need to make enabled as true
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f35142105%2feureka-discovery-client-selective-disable%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
Do it like this: create some @Configuration annotated class (class body can be omitted) ex.:
@Profile("!development")
@Configuration
@EnableDiscoveryClient
public class EurekaClientConfiguration
It means that this configuration file (and @EnableDiscoveryClient within) will be loaded in every profile except "developement".
Hope that helps,
Thanks that was what I was looking for
– zinc wombat
Feb 7 '16 at 0:50
Upvoting this because it's an awesome answer.
– ogradyjd
Nov 2 '16 at 17:21
People who use SO tend to copy code right away. Please fix "developement".wasted my whole hour.
– Sachin Verma
Apr 11 '18 at 13:32
Fixed, sorry for that. I know how big pain in the ass is looking for something like that.
– patrykos91
Apr 11 '18 at 22:01
add a comment |
Do it like this: create some @Configuration annotated class (class body can be omitted) ex.:
@Profile("!development")
@Configuration
@EnableDiscoveryClient
public class EurekaClientConfiguration
It means that this configuration file (and @EnableDiscoveryClient within) will be loaded in every profile except "developement".
Hope that helps,
Thanks that was what I was looking for
– zinc wombat
Feb 7 '16 at 0:50
Upvoting this because it's an awesome answer.
– ogradyjd
Nov 2 '16 at 17:21
People who use SO tend to copy code right away. Please fix "developement".wasted my whole hour.
– Sachin Verma
Apr 11 '18 at 13:32
Fixed, sorry for that. I know how big pain in the ass is looking for something like that.
– patrykos91
Apr 11 '18 at 22:01
add a comment |
Do it like this: create some @Configuration annotated class (class body can be omitted) ex.:
@Profile("!development")
@Configuration
@EnableDiscoveryClient
public class EurekaClientConfiguration
It means that this configuration file (and @EnableDiscoveryClient within) will be loaded in every profile except "developement".
Hope that helps,
Do it like this: create some @Configuration annotated class (class body can be omitted) ex.:
@Profile("!development")
@Configuration
@EnableDiscoveryClient
public class EurekaClientConfiguration
It means that this configuration file (and @EnableDiscoveryClient within) will be loaded in every profile except "developement".
Hope that helps,
edited Apr 11 '18 at 22:00
answered Feb 2 '16 at 17:01
patrykos91patrykos91
1,4991222
1,4991222
Thanks that was what I was looking for
– zinc wombat
Feb 7 '16 at 0:50
Upvoting this because it's an awesome answer.
– ogradyjd
Nov 2 '16 at 17:21
People who use SO tend to copy code right away. Please fix "developement".wasted my whole hour.
– Sachin Verma
Apr 11 '18 at 13:32
Fixed, sorry for that. I know how big pain in the ass is looking for something like that.
– patrykos91
Apr 11 '18 at 22:01
add a comment |
Thanks that was what I was looking for
– zinc wombat
Feb 7 '16 at 0:50
Upvoting this because it's an awesome answer.
– ogradyjd
Nov 2 '16 at 17:21
People who use SO tend to copy code right away. Please fix "developement".wasted my whole hour.
– Sachin Verma
Apr 11 '18 at 13:32
Fixed, sorry for that. I know how big pain in the ass is looking for something like that.
– patrykos91
Apr 11 '18 at 22:01
Thanks that was what I was looking for
– zinc wombat
Feb 7 '16 at 0:50
Thanks that was what I was looking for
– zinc wombat
Feb 7 '16 at 0:50
Upvoting this because it's an awesome answer.
– ogradyjd
Nov 2 '16 at 17:21
Upvoting this because it's an awesome answer.
– ogradyjd
Nov 2 '16 at 17:21
People who use SO tend to copy code right away. Please fix "developement".wasted my whole hour.
– Sachin Verma
Apr 11 '18 at 13:32
People who use SO tend to copy code right away. Please fix "developement".wasted my whole hour.
– Sachin Verma
Apr 11 '18 at 13:32
Fixed, sorry for that. I know how big pain in the ass is looking for something like that.
– patrykos91
Apr 11 '18 at 22:01
Fixed, sorry for that. I know how big pain in the ass is looking for something like that.
– patrykos91
Apr 11 '18 at 22:01
add a comment |
You can disable eureka client in application.yml using this:
eureka:
client:
enabled: false
It's also for one profile
4
Please add explanations to your answer.
– Nikolay Mihaylov
Jun 16 '16 at 8:11
in application.yml or application.properties you can set spring variables in different profiles, as it was written in third question code sample. I just suggested to disable eureka this way
– dmitryvim
Oct 14 '16 at 8:09
add a comment |
You can disable eureka client in application.yml using this:
eureka:
client:
enabled: false
It's also for one profile
4
Please add explanations to your answer.
– Nikolay Mihaylov
Jun 16 '16 at 8:11
in application.yml or application.properties you can set spring variables in different profiles, as it was written in third question code sample. I just suggested to disable eureka this way
– dmitryvim
Oct 14 '16 at 8:09
add a comment |
You can disable eureka client in application.yml using this:
eureka:
client:
enabled: false
It's also for one profile
You can disable eureka client in application.yml using this:
eureka:
client:
enabled: false
It's also for one profile
edited Jun 16 '16 at 13:02
answered Jun 16 '16 at 7:44
dmitryvimdmitryvim
7422719
7422719
4
Please add explanations to your answer.
– Nikolay Mihaylov
Jun 16 '16 at 8:11
in application.yml or application.properties you can set spring variables in different profiles, as it was written in third question code sample. I just suggested to disable eureka this way
– dmitryvim
Oct 14 '16 at 8:09
add a comment |
4
Please add explanations to your answer.
– Nikolay Mihaylov
Jun 16 '16 at 8:11
in application.yml or application.properties you can set spring variables in different profiles, as it was written in third question code sample. I just suggested to disable eureka this way
– dmitryvim
Oct 14 '16 at 8:09
4
4
Please add explanations to your answer.
– Nikolay Mihaylov
Jun 16 '16 at 8:11
Please add explanations to your answer.
– Nikolay Mihaylov
Jun 16 '16 at 8:11
in application.yml or application.properties you can set spring variables in different profiles, as it was written in third question code sample. I just suggested to disable eureka this way
– dmitryvim
Oct 14 '16 at 8:09
in application.yml or application.properties you can set spring variables in different profiles, as it was written in third question code sample. I just suggested to disable eureka this way
– dmitryvim
Oct 14 '16 at 8:09
add a comment |
Same issue here. You can simply put in your application property file the following configuration:
spring:
profiles: development
eureka:
instance:
hostname: localhost
client:
registerWithEureka: false
fetchRegistry: false
add a comment |
Same issue here. You can simply put in your application property file the following configuration:
spring:
profiles: development
eureka:
instance:
hostname: localhost
client:
registerWithEureka: false
fetchRegistry: false
add a comment |
Same issue here. You can simply put in your application property file the following configuration:
spring:
profiles: development
eureka:
instance:
hostname: localhost
client:
registerWithEureka: false
fetchRegistry: false
Same issue here. You can simply put in your application property file the following configuration:
spring:
profiles: development
eureka:
instance:
hostname: localhost
client:
registerWithEureka: false
fetchRegistry: false
edited May 14 '16 at 8:03
answered May 13 '16 at 23:51
Timi RuprechtTimi Ruprecht
5113
5113
add a comment |
add a comment |
There is a standard boolean spring-cloud property
spring.cloud.discovery.enabled
This might be better than "eureka" specific since you might be using a different provider.
In my case this doesn't work buteureka.client.enabled: falsedoes.
– Lu55
Oct 8 '18 at 20:49
add a comment |
There is a standard boolean spring-cloud property
spring.cloud.discovery.enabled
This might be better than "eureka" specific since you might be using a different provider.
In my case this doesn't work buteureka.client.enabled: falsedoes.
– Lu55
Oct 8 '18 at 20:49
add a comment |
There is a standard boolean spring-cloud property
spring.cloud.discovery.enabled
This might be better than "eureka" specific since you might be using a different provider.
There is a standard boolean spring-cloud property
spring.cloud.discovery.enabled
This might be better than "eureka" specific since you might be using a different provider.
answered Aug 4 '16 at 15:23
RafaelRafael
1,30611640
1,30611640
In my case this doesn't work buteureka.client.enabled: falsedoes.
– Lu55
Oct 8 '18 at 20:49
add a comment |
In my case this doesn't work buteureka.client.enabled: falsedoes.
– Lu55
Oct 8 '18 at 20:49
In my case this doesn't work but
eureka.client.enabled: false does.– Lu55
Oct 8 '18 at 20:49
In my case this doesn't work but
eureka.client.enabled: false does.– Lu55
Oct 8 '18 at 20:49
add a comment |
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
add a comment |
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
add a comment |
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
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
answered Dec 4 '18 at 10:24
ostmondostmond
5118
5118
add a comment |
add a comment |
With the latest version of Spring boot, Please add this in the bootstrap.yml file
Spring cloud version : Edgeware: SR3 and above
spring:
application:
name: test
cloud:
service-registry:
auto-registration:
enabled: false
This will disable eureka. To enable it, we just need to make enabled as true
add a comment |
With the latest version of Spring boot, Please add this in the bootstrap.yml file
Spring cloud version : Edgeware: SR3 and above
spring:
application:
name: test
cloud:
service-registry:
auto-registration:
enabled: false
This will disable eureka. To enable it, we just need to make enabled as true
add a comment |
With the latest version of Spring boot, Please add this in the bootstrap.yml file
Spring cloud version : Edgeware: SR3 and above
spring:
application:
name: test
cloud:
service-registry:
auto-registration:
enabled: false
This will disable eureka. To enable it, we just need to make enabled as true
With the latest version of Spring boot, Please add this in the bootstrap.yml file
Spring cloud version : Edgeware: SR3 and above
spring:
application:
name: test
cloud:
service-registry:
auto-registration:
enabled: false
This will disable eureka. To enable it, we just need to make enabled as true
answered Nov 14 '18 at 13:14
denzaldenzal
574616
574616
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f35142105%2feureka-discovery-client-selective-disable%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Possible duplicate of Including bean definition when a profile is NOT active
– g00glen00b
Feb 2 '16 at 7:03
To use class in all cases excluding one profile, you can write
@Profile("!development")– dmitryvim
Oct 14 '16 at 8:10