Spring Cloud Consul 配置 Spring 启动

Spring Cloud Consul Configuration with SpringBoot

我正在用SpringBoot配置Consul,发现这里有一个documentation。甚至浏览了其他资源,也没有找到更多的配置或场景。

所以很好奇springboot app集成consul时是否只有那些配置。我想深入了解,谁能告诉我还有其他可用的房产吗?

这些是可用的属性。

这些用于 org.springframework.cloud.consul.config.ConsulConfigPropertiesorg.springframework.cloud.consul.discovery.ConsulDiscoveryProperties

查看正在使用哪个 属性 的最佳位置是查看任何模块的自动配置。例如 Mongo 检查 MongoAutoConfigurationMongoDataAutoConfiguration。同样,对于 consul 检查 ConsulAutoConfiguration

此页面将提供配置属性

https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html

此外,您可以在 IDE 本身中查看配置属性。如果您使用的是 IntelliJ 或 STS/Eclipse,请转到 application.yml 文件,您可以通过按 Ctrl + space 查看可用的配置。它会给出建议。