mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
do some housekeeping
This commit is contained in:
parent
721df2850e
commit
bf7aec2fbc
@ -2,5 +2,4 @@ spring.application.group=com.alibaba.acm
|
||||
spring.application.name=acm-local
|
||||
server.port=18089
|
||||
spring.cloud.alicloud.acm.server-list=127.0.0.1
|
||||
spring.cloud.alicloud.acm.server-port=8080
|
||||
|
||||
spring.cloud.alicloud.acm.server-port=8080
|
@ -118,9 +118,9 @@ Nacos Client 从 Nacos Server 端获取数据时,调用的是此接口 `Config
|
||||
|
||||
* `spring.active.profile` 即为当前环境对应的 profile,详情可以参考 [Spring Boot文档](https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-profiles.html#boot-features-profiles)
|
||||
|
||||
**注意,当 activeprofile 为空时,对应的连接符 `-` 也将不存在,dataId 的拼接格式变成 `${prefix}`.`${context.type}`**
|
||||
**注意,当 activeprofile 为空时,对应的连接符 `-` 也将不存在,dataId 的拼接格式变成 `${prefix}`.`${file-extension}`**
|
||||
|
||||
* `file-extension` 为配置内容的数据格式,可以通过配置项 `spring.cloud.nacos.config.content-type`来配置。
|
||||
* `file-extension` 为配置内容的数据格式,可以通过配置项 `spring.cloud.nacos.config.file-extension`来配置。
|
||||
目前只支持 `properties` 类型。
|
||||
|
||||
#### group
|
||||
@ -168,7 +168,7 @@ Spring Boot 2.x 可以通过访问 http://127.0.0.1:18084/actuator/nacos-config
|
||||
服务端地址|spring.cloud.nacos.config.server-addr||
|
||||
DataId前缀|spring.cloud.nacos.config.prefix||spring.application.name
|
||||
Group|spring.cloud.nacos.config.group|DEFAULT_GROUP|
|
||||
dataID后缀及数据格式|spring.cloud.nacos.config.file-extension|properties|目前只支持 properties
|
||||
dataID后缀及内容文件格式|spring.cloud.nacos.config.file-extension|properties|dataId的后缀,同时也是配置内容的文件格式,目前只支持 properties
|
||||
配置内容的编码方式|spring.cloud.nacos.config.encode|UTF-8|配置的编码
|
||||
获取配置的超时时间|spring.cloud.nacos.config.timeout|3000|单位为 ms
|
||||
配置的命名空间|spring.cloud.nacos.config.namespace||常用场景之一是不同环境的配置的区分隔离,例如开发测试环境和生产环境的资源隔离等。
|
||||
|
@ -119,9 +119,9 @@ In Nacos Config Starter, the splicing format of dataId is as follows
|
||||
|
||||
* `spring.active.profile` is the profile corresponding to the current environment. For details, please refer to [Spring Boot Doc](https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-profiles.html#boot-features-profiles)
|
||||
|
||||
**Note: when the activeprofile is empty, the corresponding connector `-` will also not exist, and the splicing format of the dataId becomes `${prefix}`.`${context.type}`**
|
||||
**Note: when the activeprofile is empty, the corresponding connector `-` will also not exist, and the splicing format of the dataId becomes `${prefix}`.`${file-extension}`**
|
||||
|
||||
* `file-extension` is the data format of the configuration content, which can be configured by the configuration item `spring.cloud.nacos.config.content-type`.
|
||||
* `file-extension` is the data format of the configuration content, which can be configured by the configuration item `spring.cloud.nacos.config.file-extension`.
|
||||
Currently only the `properties` type is supported.
|
||||
|
||||
#### group
|
||||
|
@ -197,7 +197,7 @@ AccessKey|spring.cloud.nacos.discovery.access-key||
|
||||
SecretKey|spring.cloud.nacos.discovery.secret-key||
|
||||
Metadata|spring.cloud.nacos.discovery.metadata||使用Map格式配置
|
||||
日志文件名|spring.cloud.nacos.discovery.log-name||
|
||||
接入点|spring.cloud.nacos.discovery.enpoint|UTF-8|地域的某个服务的入口域名,通过此域名可以动态地拿到服务端地址
|
||||
接入点|spring.cloud.nacos.discovery.endpoint|UTF-8|地域的某个服务的入口域名,通过此域名可以动态地拿到服务端地址
|
||||
是否集成Ribbon|ribbon.nacos.enabled|true|
|
||||
|
||||
|
||||
|
@ -205,7 +205,7 @@ AccessKey|spring.cloud.nacos.discovery.access-key||
|
||||
SecretKey|spring.cloud.nacos.discovery.secret-key||
|
||||
Metadata|spring.cloud.nacos.discovery.metadata||Extended data, Configure using Map format
|
||||
log name|spring.cloud.nacos.discovery.log-name||
|
||||
endpoint|spring.cloud.nacos.discovery.enpoint||The domain name of a service, through which the server address can be dynamically obtained.
|
||||
endpoint|spring.cloud.nacos.discovery.endpoint||The domain name of a service, through which the server address can be dynamically obtained.
|
||||
Integration Ribbon|ribbon.nacos.enabled|true|
|
||||
|
||||
|
||||
|
@ -83,7 +83,6 @@ public class NacosPropertySourceBuilder {
|
||||
String data = null;
|
||||
try {
|
||||
data = configService.getConfig(dataId, group, timeout);
|
||||
// todo add content type yaml support
|
||||
if (!StringUtils.isEmpty(data)) {
|
||||
logger.info(String.format("Loading nacos data, dataId: '%s', group: '%s'",
|
||||
dataId, group));
|
||||
@ -95,7 +94,7 @@ public class NacosPropertySourceBuilder {
|
||||
return properties;
|
||||
}
|
||||
else if (fileExtension.equalsIgnoreCase("yaml")
|
||||
|| fileExtension.equalsIgnoreCase("yml")) {
|
||||
|| fileExtension.equalsIgnoreCase("yml")) {
|
||||
YamlPropertiesFactoryBean yamlFactory = new YamlPropertiesFactoryBean();
|
||||
yamlFactory.setResources(new ByteArrayResource(data.getBytes()));
|
||||
return yamlFactory.getObject();
|
||||
|
@ -82,6 +82,13 @@
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<scope>provided</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
|
@ -29,7 +29,7 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
* @author xiaolongzuo
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = AliCloudSpringApplicationTests.EurekaClientDisabledApp.class, properties = {
|
||||
@SpringBootTest(classes = AliCloudSpringApplicationTests.AliCloudDisabledApp.class, properties = {
|
||||
"spring.application.name=myapp",
|
||||
"spring.cloud.alicloud.edas.application.name=myapp",
|
||||
"spring.cloud.alicloud.access-key=ak", "spring.cloud.alicloud.secret-key=sk",
|
||||
@ -43,7 +43,7 @@ public class AliCloudSpringApplicationTests {
|
||||
}
|
||||
|
||||
@SpringBootApplication
|
||||
public static class EurekaClientDisabledApp {
|
||||
public static class AliCloudDisabledApp {
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user