{"id":1470,"date":"2023-03-24T22:24:45","date_gmt":"2023-03-24T14:24:45","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1470"},"modified":"2023-04-28T20:35:29","modified_gmt":"2023-04-28T12:35:29","slug":"spring-cloud-integrate-nacos-debugging","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/24\/spring-cloud-integrate-nacos-debugging\/","title":{"rendered":"Spring Cloud \u96c6\u6210 Nacos \u8c03\u8bd5"},"content":{"rendered":"<h2>\u7248\u672c\u5339\u914d<\/h2>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\">Spring Boot Version<\/th>\n<th style=\"text-align: center;\">Spring Cloud Version<\/th>\n<th style=\"text-align: center;\">Nacos Version<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center;\">2.1.X.RELEASE<\/td>\n<td style=\"text-align: center;\">Greenwich.RELEASE<\/td>\n<td style=\"text-align: center;\">0.2.1.RELEASE<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">2.0.X.RELEASE<\/td>\n<td style=\"text-align: center;\">Finchley.RELEASE<\/td>\n<td style=\"text-align: center;\">0.2.0.RELEASE<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">1.5.X.RELEASE<\/td>\n<td style=\"text-align: center;\">Edgware.RELEASE<\/td>\n<td style=\"text-align: center;\">0.1.x.RELEASE<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><!-- more --><\/p>\n<pre><code class=\"language-xml\">&lt;dependencyManagement&gt;\n    &lt;dependencies&gt;\n        &lt;dependency&gt;\n            &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\n            &lt;artifactId&gt;spring-boot-starter-web&lt;\/artifactId&gt;\n            &lt;version&gt;2.1.6.RELEASE&lt;\/version&gt;\n        &lt;\/dependency&gt;\n        &lt;dependency&gt;\n            &lt;groupId&gt;org.projectlombok&lt;\/groupId&gt;\n            &lt;artifactId&gt;lombok&lt;\/artifactId&gt;\n            &lt;optional&gt;true&lt;\/optional&gt;\n        &lt;\/dependency&gt;\n        &lt;dependency&gt;\n            &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;\n            &lt;artifactId&gt;spring-cloud-dependencies&lt;\/artifactId&gt;\n            &lt;version&gt;Greenwich.RELEASE&lt;\/version&gt;\n            &lt;type&gt;pom&lt;\/type&gt;\n            &lt;scope&gt;import&lt;\/scope&gt;\n        &lt;\/dependency&gt;\n    &lt;\/dependencies&gt;\n&lt;\/dependencyManagement&gt;<\/code><\/pre>\n<h2>properties config<\/h2>\n<h3>bootstrap.properties<\/h3>\n<pre><code>spring.cloud.nacos.config.server-addr=192.168.1.20:8848\nspring.application.name=service-provider\n#spring.cloud.nacos.config.file-extension=yaml\nspring.cloud.nacos.config.file-extension=properties<\/code><\/pre>\n<h3>update config<\/h3>\n<pre><code>> curl -X POST &quot;http:\/\/192.168.165.240:8848\/nacos\/v1\/cs\/configs?dataId=service-provider.properties&amp;group=DEFAULT_GROUP&amp;content=useLocalCache=true&quot;\ntrue<\/code><\/pre>\n<pre><code>Bean &#039;org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration&#039; 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)\nLoading nacos data, dataId: &#039;service-provider.properties&#039;, group: &#039;DEFAULT_GROUP&#039;\nLocated property source: CompositePropertySource {name=&#039;NACOS&#039;, propertySources=[NacosPropertySource {name=&#039;service-provider.properties&#039;}]}\nNo active profile set, falling back to default profiles: default\nStarted application in 2.105 seconds (JVM running for 34.992)\nRefresh keys changed: [useLocalCache]<\/code><\/pre>\n<pre><code>> curl -X POST &quot;http:\/\/192.168.165.240:8848\/nacos\/v1\/cs\/configs?dataId=service-provider.properties&amp;group=DEFAULT_GROUP&amp;content=useLocalCache=false&quot;\ntrue<\/code><\/pre>\n<pre><code>Bean &#039;org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration&#039; 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)\nLoading nacos data, dataId: &#039;service-provider.properties&#039;, group: &#039;DEFAULT_GROUP&#039;\nLocated property source: CompositePropertySource {name=&#039;NACOS&#039;, propertySources=[NacosPropertySource {name=&#039;service-provider.properties&#039;}]}\nNo active profile set, falling back to default profiles: default\nStarted application in 2.234 seconds (JVM running for 60.858)\nRefresh keys changed: [useLocalCache]<\/code><\/pre>\n<h2>yaml config<\/h2>\n<h3>bootstrap.properties<\/h3>\n<pre><code>spring.cloud.nacos.config.server-addr=192.168.1.20:8848\nspring.application.name=service-provider\nspring.cloud.nacos.config.file-extension=yaml\n#spring.cloud.nacos.config.file-extension=properties<\/code><\/pre>\n<h3>update config<\/h3>\n<pre><code>> curl -X POST &quot;http:\/\/192.168.1.20:8848\/nacos\/v1\/cs\/configs?dataId=service-provider.yaml&amp;group=DEFAULT_GROUP&amp;content=useLocalCache:%20false&quot;\ntrue<\/code><\/pre>\n<pre><code>Bean &#039;org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration&#039; 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)\nLoading nacos data, dataId: &#039;service-provider.yaml&#039;, group: &#039;DEFAULT_GROUP&#039;\nLocated property source: CompositePropertySource {name=&#039;NACOS&#039;, propertySources=[NacosPropertySource {name=&#039;service-provider.yaml&#039;}]}\nNo active profile set, falling back to default profiles: default\nStarted application in 2.238 seconds (JVM running for 252.568)\nRefresh keys changed: [useLocalCache]<\/code><\/pre>\n<pre><code>> curl -X POST &quot;http:\/\/192.168.1.20:8848\/nacos\/v1\/cs\/configs?dataId=service-provider.yaml&amp;group=DEFAULT_GROUP&amp;content=useLocalCache:%20true\ntrue<\/code><\/pre>\n<pre><code>Bean &#039;org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration&#039; 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)\nLoading nacos data, dataId: &#039;service-provider.yaml&#039;, group: &#039;DEFAULT_GROUP&#039;\nLocated property source: CompositePropertySource {name=&#039;NACOS&#039;, propertySources=[NacosPropertySource {name=&#039;service-provider.yaml&#039;}]}\nNo active profile set, falling back to default profiles: default\nStarted application in 2.285 seconds (JVM running for 272.409)\nRefresh keys changed: [useLocalCache]<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u7248\u672c\u5339\u914d Spring Boot Version Spring Cloud Version Nacos Ver [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,42],"tags":[],"class_list":["post-1470","post","type-post","status-publish","format-standard","hentry","category-nacos","category-spring-cloud"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1470","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1470"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1470\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1470"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1470"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1470"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}