This is an automated email from the ASF dual-hosted git repository.
liuhongyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new cde3f548f7 fix:ShenyuBootstrapApplication run failed when using Nacos
data sync (#6124)
cde3f548f7 is described below
commit cde3f548f7284fafd23ac8bb3c91ed716d4d9c51
Author: Wweiei <[email protected]>
AuthorDate: Tue Sep 2 10:56:02 2025 +0800
fix:ShenyuBootstrapApplication run failed when using Nacos data sync (#6124)
* fix:ShenyuBootstrapApplication run failed when using Nacos data sync
* fix:checkstyle error in NacosSyncDataConfiguration
---------
Co-authored-by: aias00 <[email protected]>
---
.../shenyu/infra/nacos/autoconfig/ConditionOnSyncNacos.java | 2 +-
.../starter/sync/data/nacos/NacosSyncDataConfiguration.java | 13 ++++++++-----
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git
a/shenyu-infra/shenyu-infra-nacos/src/main/java/org/apache/shenyu/infra/nacos/autoconfig/ConditionOnSyncNacos.java
b/shenyu-infra/shenyu-infra-nacos/src/main/java/org/apache/shenyu/infra/nacos/autoconfig/ConditionOnSyncNacos.java
index 1404668674..90dd3ec92b 100644
---
a/shenyu-infra/shenyu-infra-nacos/src/main/java/org/apache/shenyu/infra/nacos/autoconfig/ConditionOnSyncNacos.java
+++
b/shenyu-infra/shenyu-infra-nacos/src/main/java/org/apache/shenyu/infra/nacos/autoconfig/ConditionOnSyncNacos.java
@@ -27,7 +27,7 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * Enable etcd data sync.
+ * Enable nacos data sync.
*/
@Target({ElementType.TYPE, ElementType.METHOD})
diff --git
a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-sync-data-center/shenyu-spring-boot-starter-sync-data-nacos/src/main/java/org/apache/shenyu/springboot/starter/sync/data/nacos/NacosSyncDataConfiguration.java
b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-sync-data-center/shenyu-spring-boot-starter-sync-data-nacos/src/main/java/org/apache/shenyu/springboot/starter/sync/data/nacos/NacosSyncDataConfiguration.java
index 32508ecedf..6543f96c19 100644
---
a/shenyu-spring-boot-starter/shenyu-spring-boot-starter-sync-data-center/shenyu-spring-boot-starter-sync-data-nacos/src/main/java/org/apache/shenyu/springboot/starter/sync/data/nacos/NacosSyncDataConfiguration.java
+++
b/shenyu-spring-boot-starter/shenyu-spring-boot-starter-sync-data-center/shenyu-spring-boot-starter-sync-data-nacos/src/main/java/org/apache/shenyu/springboot/starter/sync/data/nacos/NacosSyncDataConfiguration.java
@@ -23,6 +23,7 @@ import com.alibaba.nacos.api.config.ConfigService;
import org.apache.commons.lang3.StringUtils;
import org.apache.shenyu.common.config.ShenyuConfig;
import org.apache.shenyu.infra.nacos.autoconfig.ConditionOnSyncNacos;
+import org.apache.shenyu.infra.nacos.autoconfig.NacosProperties;
import org.apache.shenyu.infra.nacos.config.NacosConfig;
import org.apache.shenyu.sync.data.api.AuthDataSubscriber;
import org.apache.shenyu.sync.data.api.DiscoveryUpstreamDataSubscriber;
@@ -35,6 +36,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import
org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -50,6 +52,7 @@ import java.util.Properties;
@Configuration
@ConditionOnSyncNacos
@ConditionalOnClass({NacosSyncDataService.class, ConfigService.class})
+@EnableConfigurationProperties(NacosProperties.class)
public class NacosSyncDataConfiguration {
private static final Logger LOGGER =
LoggerFactory.getLogger(NacosSyncDataConfiguration.class);
@@ -112,14 +115,14 @@ public class NacosSyncDataConfiguration {
}
/**
- * Http config.
+ * nacos config.
*
- * @return the http config
+ * @param nacosProperties the nacos properties
+ * @return the nacos config
*/
@Bean
@ConditionOnSyncNacos
- public NacosConfig nacosConfig() {
-
- return NacosConfig.builder().build();
+ public NacosConfig nacosConfig(final NacosProperties nacosProperties) {
+ return nacosProperties.getNacos();
}
}