Closed wchappygood closed 4 weeks ago
这个对象初始化的时候,
这个对象还没初始化导致,配置没有修改到
找到原因了
如果使用bootstrap.yml做配置,需指定spring.cloud.polaris.enabled为true。
如果使用bootstrap.yml做配置,需指定spring.cloud.polaris.enabled为true。
我说下我的理解不知道对不对: 配置PolarisConfigBootstrapAutoConfiguration在bootstrap阶段就会创建PolarisContext,并把PolarisConfigModifier处理了, 而StatConfigModifier并非是bootstrap阶段,所以就无法修改配置了。
所以现在有没什么其他方法方法可以用配置中心的配置去修改配置,达到自定义端口的效果
有PolarisStatPropertiesBootstrapConfiguration,那么bootstrap阶段,StatConfigModifier应该会生效才对
在你的bootstrap.yml下加一个这个配置试试呢?
spring:
config:
import: optional:polaris
PolarisStatPropertiesBootstrapConfiguration
需要手动设置这个值才能生效
但是还是不能读取配置中心的配置来设置端口
在你的bootstrap.yml下加一个这个配置试试呢?
spring: config: import: optional:polaris
不得行,还是无法读取配置中心的配置设置端口
@wchappygood 如下配置无法设置远端配置的端口吗?我这里尝试是可以的。
spring:
config:
import: optional:polaris
cloud:
polaris:
enbaled: true
@wchappygood 如下配置无法设置远端配置的端口吗?我这里尝试是可以的。
spring: config: import: optional:polaris cloud: polaris: enbaled: true
可以改变。但是只能通过配置在bootstrap.yml才能生效。
@wchappygood 你的诉求是,这个配置也只通过远程配置吗?
spring:
cloud:
polaris:
enbaled: true
bootstrap.yml只留?
spring:
config:
import: optional:polaris
@wchappygood 你的诉求是,这个配置也只通过远程配置吗?
spring: cloud: polaris: enbaled: true
bootstrap.yml只留?
spring: config: import: optional:polaris
我们的诉求是spring.cloud.polaris.stat.port这个可以配置在配置中心,我们用bootstrap.yml启动的
@wchappygood 我用这个配置,是可以支持你的需求的。 应用内bootstrap.yml:
spring:
config:
import: optional:polaris
cloud:
polaris:
enbaled: true
配置中心:
spring.cloud.polaris.stat.port
谢谢成功了
版本: 1.12.4-2021.0.8
spring.cloud.polaris.stat.port设置成28085