diff --git a/spring-cloud-alibaba-nacos-config/pom.xml b/spring-cloud-alibaba-nacos-config/pom.xml index cd7a9e92c..12ff873c1 100644 --- a/spring-cloud-alibaba-nacos-config/pom.xml +++ b/spring-cloud-alibaba-nacos-config/pom.xml @@ -45,7 +45,12 @@ provided true - + + org.springframework.boot + spring-boot-configuration-processor + provided + true + org.springframework.boot spring-boot diff --git a/spring-cloud-alibaba-nacos-config/src/main/java/org/springframework/cloud/alibaba/nacos/NacosConfigProperties.java b/spring-cloud-alibaba-nacos-config/src/main/java/org/springframework/cloud/alibaba/nacos/NacosConfigProperties.java index 24931e484..f445ffe7a 100644 --- a/spring-cloud-alibaba-nacos-config/src/main/java/org/springframework/cloud/alibaba/nacos/NacosConfigProperties.java +++ b/spring-cloud-alibaba-nacos-config/src/main/java/org/springframework/cloud/alibaba/nacos/NacosConfigProperties.java @@ -35,12 +35,12 @@ public class NacosConfigProperties { private String serverAddr; /** - * nacos config encode + * encode for nacos config content. */ private String encode; /** - * nacos config group + * nacos config group, group is config data meta info. */ private String group = "DEFAULT_GROUP"; @@ -49,37 +49,37 @@ public class NacosConfigProperties { */ private String prefix; /** - * nacos config dataId contentType + * the content type of nacos config content. */ private String contentType = "properties"; /** - * timeout to get configuration + * timeout for get config from nacos. */ private int timeout = 3000; /** - * endpoint for Nacos + * endpoint for Nacos, the domain name of a service, through which the server address can be dynamically obtained. */ private String endpoint; /** - * Nacos namespace + * namespace, separation configuration of different environments. */ private String namespace; /** - * Nacos access key + * access key for namespace. */ private String accessKey; /** - * Nacos secret key + * secret key for namespace. */ private String secretKey; /** - * nacos config context path + * context path for nacos config server. */ private String contextPath; diff --git a/spring-cloud-alibaba-nacos-config/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-alibaba-nacos-config/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 34699e4e0..189ae565e 100644 --- a/spring-cloud-alibaba-nacos-config/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-cloud-alibaba-nacos-config/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -1,32 +1,20 @@ -{ - "properties": [ - { - "name": "spring.cloud.nacos.config.server-addr", - "type": "java.lang.String", - "defaultValue": "", - "description": "nacos config server address." - }, - { - "name": "spring.cloud.nacos.config.timeout", - "type": "java.lang.Long", - "defaultValue": 3000, - "description": "sentinel api port." - }, - { - "name": "spring.cloud.sentinel.dashboard", - "type": "java.lang.String", - "description": "sentinel dashboard address, won't try to connect dashboard when address is empty." - }, - { - "name": "spring.cloud.sentinel.filter.order", - "type": "java.lang.Integer", - "defaultValue": "Integer.MIN_VALUE", - "description": "Sentinel filter chain order, will be set to FilterRegistrationBean." - }, - { - "name": "spring.cloud.sentinel.filter.urlPatterns", - "type": "java.util.List", - "description": "URL pattern for Sentinel filter, default contains '/*'." - } - ] -} +{"properties": [ + { + "name": "spring.cloud.nacos.config.encode", + "type": "java.lang.String", + "defaultValue": "UTF-8", + "description": "default encode for nacos config content." + }, + { + "name": "spring.cloud.nacos.config.prefix", + "type": "java.lang.String", + "defaultValue": "${spring.application.name}", + "description": "the prefix of dataId, nacos config data meta info. dataId = prefix + '-' + ${spring.active.profile} + `-` + ${spring.cloud.nacos.config.content-type}." + }, + { + "name": "spring.cloud.nacos.config.content-type", + "type": "java.lang.String", + "defaultValue": "properties", + "description": "the content type of nacos config content, only support properties now." + } +]} \ No newline at end of file diff --git a/spring-cloud-alibaba-nacos-discovery/pom.xml b/spring-cloud-alibaba-nacos-discovery/pom.xml index 601156c64..537d4da52 100644 --- a/spring-cloud-alibaba-nacos-discovery/pom.xml +++ b/spring-cloud-alibaba-nacos-discovery/pom.xml @@ -50,8 +50,12 @@ provided true - - + + org.springframework.boot + spring-boot-configuration-processor + provided + true + org.springframework.boot spring-boot diff --git a/spring-cloud-alibaba-nacos-discovery/src/main/java/org/springframework/cloud/alibaba/nacos/NacosDiscoveryProperties.java b/spring-cloud-alibaba-nacos-discovery/src/main/java/org/springframework/cloud/alibaba/nacos/NacosDiscoveryProperties.java index 6ecd07608..f042e4bcc 100644 --- a/spring-cloud-alibaba-nacos-discovery/src/main/java/org/springframework/cloud/alibaba/nacos/NacosDiscoveryProperties.java +++ b/spring-cloud-alibaba-nacos-discovery/src/main/java/org/springframework/cloud/alibaba/nacos/NacosDiscoveryProperties.java @@ -44,17 +44,17 @@ import java.util.Objects; public class NacosDiscoveryProperties { /** - * nacos naming server address + * nacos discovery server address */ private String serverAddr; /** - * nacos naming server endpoint + * the domain name of a service, through which the server address can be dynamically obtained. */ private String endpoint; /** - * nacos naming namespaceļ¼Œtodo + * namespace, separation registry of different environments. */ private String namespace; @@ -64,45 +64,45 @@ public class NacosDiscoveryProperties { private String logName; /** - * service name to publish + * service name to registry */ @Value("${spring.cloud.nacos.discovery.service:${spring.application.name:}}") private String service; /** - * weights for service instance + * weight for service instance, the larger the value, the larger the weight. */ private float weight = 1; /** - * publish to which virtual clusterName + * cluster name for nacos server. */ - private String clusterName = "DEFAULT";//todo default value is ? + private String clusterName = "DEFAULT"; /** - * extra metadata to publish + * extra metadata to register. */ private Map metadata = new HashMap<>(); /** - * if you just want to subscribe, but don't want to publish your service, set it to + * if you just want to subscribe, but don't want to register your service, set it to * false. */ private boolean registerEnabled = true; /** - * The ip address your want to publish for your service instance, needn't to set it if + * The ip address your want to register for your service instance, needn't to set it if * the auto detect ip works well */ private String ip; /** - * which network interface's ip you want to publish + * which network interface's ip you want to register */ private String networkInterface = ""; /** - * The port your want to publish for your service instance, needn't to set it if the + * The port your want to register for your service instance, needn't to set it if the * auto detect port works well */ private int port = -1; @@ -113,12 +113,12 @@ public class NacosDiscoveryProperties { private boolean secure = false; /** - * access key for nacos discovery + * access key for namespace. */ private String accessKey; /** - * secret key for nacos discovery + * secret key for namespace. */ private String secretKey; diff --git a/spring-cloud-alibaba-nacos-discovery/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-cloud-alibaba-nacos-discovery/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 000000000..2ea041b08 --- /dev/null +++ b/spring-cloud-alibaba-nacos-discovery/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,8 @@ +{"properties": [ + { + "name": "spring.cloud.nacos.discovery.service", + "type": "java.lang.String", + "defaultValue": "${spring.application.name}", + "description": "the service name to register, default value is ${spring.application.name}." + } +]}