diff --git a/austin-support/pom.xml b/austin-support/pom.xml
index c091f98..044423a 100644
--- a/austin-support/pom.xml
+++ b/austin-support/pom.xml
@@ -75,7 +75,7 @@
com.ctrip.framework.apollo
- apollo-client-config-data
+ apollo-client
diff --git a/austin-support/src/main/java/com/java3y/austin/support/utils/NacosUtils.java b/austin-support/src/main/java/com/java3y/austin/support/utils/NacosUtils.java
index 4437659..1dc6ee0 100644
--- a/austin-support/src/main/java/com/java3y/austin/support/utils/NacosUtils.java
+++ b/austin-support/src/main/java/com/java3y/austin/support/utils/NacosUtils.java
@@ -1,8 +1,8 @@
package com.java3y.austin.support.utils;
import cn.hutool.core.util.StrUtil;
-import com.alibaba.nacos.api.NacosFactory;
-import com.alibaba.nacos.api.PropertyKeyConst;
+import com.alibaba.nacos.api.annotation.NacosInjected;
+import com.alibaba.nacos.api.config.ConfigService;
import com.alibaba.nacos.api.exception.NacosException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.exception.ExceptionUtils;
@@ -22,19 +22,14 @@ import java.util.Properties;
@Slf4j
@Component
public class NacosUtils {
- @Value("${austin.nacos.server}")
- private String nacosServer;
- @Value("${austin.nacos.username}")
- private String nacosUsername;
- @Value("${austin.nacos.password}")
- private String nacosPassword;
+ @NacosInjected
+ private ConfigService configService;
+
@Value("${austin.nacos.group}")
private String nacosGroup;
@Value("${austin.nacos.dataId}")
private String nacosDataId;
- @Value("${austin.nacos.namespace}")
- private String nacosNamespace;
- private final Properties request = new Properties();
+
private final Properties properties = new Properties();
public String getProperty(String key, String defaultValue) {
@@ -53,12 +48,7 @@ public class NacosUtils {
private String getContext() {
String context = null;
try {
- request.put(PropertyKeyConst.SERVER_ADDR, nacosServer);
- request.put(PropertyKeyConst.NAMESPACE, nacosNamespace);
- request.put(PropertyKeyConst.USERNAME, nacosUsername);
- request.put(PropertyKeyConst.PASSWORD, nacosPassword);
- context = NacosFactory.createConfigService(request)
- .getConfig(nacosDataId, nacosGroup, 5000);
+ context = configService.getConfig(nacosDataId, nacosGroup, 5000);
} catch (NacosException e) {
log.error("Nacos error:{}", ExceptionUtils.getStackTrace(e));
}
diff --git a/austin-web/src/main/resources/application.properties b/austin-web/src/main/resources/application.properties
index af996f3..5a2ee21 100644
--- a/austin-web/src/main/resources/application.properties
+++ b/austin-web/src/main/resources/application.properties
@@ -77,12 +77,13 @@ apollo.bootstrap.namespaces=boss.austin,dynamic-tp-apollo-dtp.yml
########################################## apollo end ##########################################
########################################## nacos start ##########################################
-austin.nacos.server=austin.nacos:8848
-austin.nacos.username=nacos
-austin.nacos.password=nacos
+nacos.config.server-addr=austin.nacos:8848
+nacos.config.username=nacos
+nacos.config.password=nacos
+nacos.config.namespace=9537c674-f3a6-4203-b286-ef0c36bfacb2
+
austin.nacos.dataId=austin
austin.nacos.group=DEFAULT_GROUP
-austin.nacos.namespace=9537c674-f3a6-4203-b286-ef0c36bfacb2
nacos.config.enabled=${austin.nacos.enabled}
########################################## nacos end ##########################################
diff --git a/pom.xml b/pom.xml
index 387a092..1208e46 100644
--- a/pom.xml
+++ b/pom.xml
@@ -95,8 +95,8 @@
com.ctrip.framework.apollo
- apollo-client-config-data
- 1.9.1
+ apollo-client
+ 2.1.0