版本匹配
| Spring Boot Version |
Spring Cloud Version |
Nacos Version |
| 2.1.X.RELEASE |
Greenwich.RELEASE |
0.2.1.RELEASE |
| 2.0.X.RELEASE |
Finchley.RELEASE |
0.2.0.RELEASE |
| 1.5.X.RELEASE |
Edgware.RELEASE |
0.1.x.RELEASE |
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.1.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Greenwich.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
properties config
bootstrap.properties
spring.cloud.nacos.config.server-addr=192.168.1.20:8848
spring.application.name=service-provider
#spring.cloud.nacos.config.file-extension=yaml
spring.cloud.nacos.config.file-extension=properties
update config
> curl -X POST "http://192.168.165.240:8848/nacos/v1/cs/configs?dataId=service-provider.properties&group=DEFAULT_GROUP&content=useLocalCache=true"
true
Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$bed7de61] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
Loading nacos data, dataId: 'service-provider.properties', group: 'DEFAULT_GROUP'
Located property source: CompositePropertySource {name='NACOS', propertySources=[NacosPropertySource {name='service-provider.properties'}]}
No active profile set, falling back to default profiles: default
Started application in 2.105 seconds (JVM running for 34.992)
Refresh keys changed: [useLocalCache]
> curl -X POST "http://192.168.165.240:8848/nacos/v1/cs/configs?dataId=service-provider.properties&group=DEFAULT_GROUP&content=useLocalCache=false"
true
Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$bed7de61] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
Loading nacos data, dataId: 'service-provider.properties', group: 'DEFAULT_GROUP'
Located property source: CompositePropertySource {name='NACOS', propertySources=[NacosPropertySource {name='service-provider.properties'}]}
No active profile set, falling back to default profiles: default
Started application in 2.234 seconds (JVM running for 60.858)
Refresh keys changed: [useLocalCache]
yaml config
bootstrap.properties
spring.cloud.nacos.config.server-addr=192.168.1.20:8848
spring.application.name=service-provider
spring.cloud.nacos.config.file-extension=yaml
#spring.cloud.nacos.config.file-extension=properties
update config
> curl -X POST "http://192.168.1.20:8848/nacos/v1/cs/configs?dataId=service-provider.yaml&group=DEFAULT_GROUP&content=useLocalCache:%20false"
true
Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$613642c8] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
Loading nacos data, dataId: 'service-provider.yaml', group: 'DEFAULT_GROUP'
Located property source: CompositePropertySource {name='NACOS', propertySources=[NacosPropertySource {name='service-provider.yaml'}]}
No active profile set, falling back to default profiles: default
Started application in 2.238 seconds (JVM running for 252.568)
Refresh keys changed: [useLocalCache]
> curl -X POST "http://192.168.1.20:8848/nacos/v1/cs/configs?dataId=service-provider.yaml&group=DEFAULT_GROUP&content=useLocalCache:%20true
true
Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$613642c8] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
Loading nacos data, dataId: 'service-provider.yaml', group: 'DEFAULT_GROUP'
Located property source: CompositePropertySource {name='NACOS', propertySources=[NacosPropertySource {name='service-provider.yaml'}]}
No active profile set, falling back to default profiles: default
Started application in 2.285 seconds (JVM running for 272.409)
Refresh keys changed: [useLocalCache]