apache / apache/dubbo

dubbo.properties占位符表达式不支持默认值

Open
#7,068 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
41.6k
Forks
26.4k
Avg merge
15h 13m
Merged PRs (30d)
4

Description

- [x] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate.
- [x] I have checked the [FAQ](https://github.com/apache/dubbo/blob/master/FAQ.md) of this repository and believe that this is not a duplicate.

### Environment

* Dubbo version: 2.7.7
* Operating System version: Windows 10
* Java version: 1.8

### Steps to reproduce this issue

1. org.apache.dubbo.common.utils.ConfigUtils中的replaceProperty方法不支持默认值;
2. Run unit test always failed, **defaultA** and **defaultB** is default value.
```
@Test
public void testReplacePropertyDefault() throws Exception {
String s = ConfigUtils.replaceProperty("1${a.b.c:defaultA}2${a.b.c:defaultB}3", Collections.emptyMap());
assertEquals(s, "1defaultA2defaultB3");
}
```

Pls. provide [GitHub address] to reproduce this issue.
https://github.com/apache/dubbo/blob/d98d48914b139d6abb2139ea36e51e536713edfe/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ConfigUtils.java#L186

### Expected Result

dubbo.properties 占位符表达式能够支持默认值

### Actual Result

What actually happens?

dubbo.properties占位符表达式不支持默认值

上面的单元测试运行失败:
```
Expected :1:defaultA}2:defaultB}3
Actual :1defaultA2defaultB3
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.