2
私は春のブートアプリケーションを持っており、私は領事エージェントに持っているプロパティを取得したいと思います。 スプリングブート領事サーバからプロパティを取得
@EnableDiscoveryClient
@SpringBootApplication(scanBasePackages={"com.commons"})
public class MainAppProxy implements CommandLineRunner {
@Value("${proxy.endpoint}")
private String endpointAddress;
私application.properties
は、私は、次の設定(ショートバージョン)が <artifactId>spring-cloud-dependencies</artifactId>
<version>Camden.SR5</version>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
プロパティが上に保存されているのsrc /メイン/リソースのpom.xmlで
spring.application.name=SOAPProxy
spring.cloud.consul.host=http://10.0.1.241
spring.cloud.consul.port=8500
spring.cloud.config.discovery.enabled=false
の下にありますこの形式の領事: ビジネス/ SOAPProxy/proxy.endpoint
アプリケーションが起動すると、領事を見つけたようですが、領事@Value( "$ {proxy.endpoint}")を試す前に値を取得できません 領事でどのようにプロパティを取得できますか?
にすべての構成負荷あなたは領事から設定を取得する必要がありますか? – wthamira