有没有办法根据弹簧配置文件禁用spring-boot eureka客户端注册?
目前我使用以下注释:
@Configuration
@EnableAutoConfiguration
@EnableDiscoveryClient
@EnableConfigServer
public class ConfigApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigApplication.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
我需要的是一个条件如(借用伪代码)
@if (Profile!="development")
@EnableDiscoveryClient
@endif
Run Code Online (Sandbox Code Playgroud)
或者在应用程序属性文件中的某种方式.我已经尝试将application.yml文件设置为:
spring:
profiles: development
cloud:
discovery:
enabled: false
Run Code Online (Sandbox Code Playgroud)
但这没效果.