2
我有一个弹簧启动应用程序,我想获取我在代理上的属性。Spring boot从领事服务器获取属性
@EnableDiscoveryClient
@SpringBootApplication(scanBasePackages={"com.commons"})
public class MainAppProxy implements CommandLineRunner {
@Value("${proxy.endpoint}")
private String endpointAddress;
我application.properties是在src /主/资源
spring.application.name=SOAPProxy
spring.cloud.consul.host=http://10.0.1.241
spring.cloud.consul.port=8500
spring.cloud.config.discovery.enabled=false
在pom.xml中,我有以下的配置(精简版)
<artifactId>spring-cloud-dependencies</artifactId>
<version>Camden.SR5</version>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
属性存储上领事格式为: 商务/的SOAPProxy/proxy.endpoint
当应用程序引导,似乎它找到领事,但它不能像试用consul @Value(“$ {proxy.endpoint}”)之前那样得到值。我怎样才能获得领事上的属性?
你需要从领事获取配置? – wthamira