diff --git a/pom.xml b/pom.xml
index d117a51..46e950b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -61,7 +61,7 @@
1.4.0
2.6
- 2.17.2
+ 2.18.12
6.1.0
4.13.2
1.18.46
@@ -359,7 +359,7 @@
false
false
- -Xmx1024m -Dfile.encoding=UTF-8
+ @{argLine} -Xmx1024m -Dfile.encoding=UTF-8
${basedir}/target/test-classes
diff --git a/src/main/java/io/github/easy4j/opencode/OpenCodeHttpClientConfig.java b/src/main/java/io/github/easy4j/opencode/OpenCodeHttpClientConfig.java
index 05e1110..7dd3fd3 100644
--- a/src/main/java/io/github/easy4j/opencode/OpenCodeHttpClientConfig.java
+++ b/src/main/java/io/github/easy4j/opencode/OpenCodeHttpClientConfig.java
@@ -130,6 +130,26 @@ public class OpenCodeHttpClientConfig {
*/
private String defaultAgent;
+ /** Legacy bean alias for {@link #getBaseUrl()}. */
+ public String getServerUrl() {
+ return baseUrl;
+ }
+
+ /** Sets the server URL through the legacy bean property. */
+ public void setServerUrl(String serverUrl) {
+ this.baseUrl = serverUrl;
+ }
+
+ /** Legacy bean alias for {@link #getStreamEventQueueCapacity()}. */
+ public int getSseEventQueueCapacity() {
+ return streamEventQueueCapacity;
+ }
+
+ /** Sets the event queue capacity through the legacy bean property. */
+ public void setSseEventQueueCapacity(int capacity) {
+ this.streamEventQueueCapacity = capacity;
+ }
+
/**
* 解析用于 HTTP Basic Auth 的密码。
*
diff --git a/src/test/java/io/github/easy4j/opencode/OpenCodeHttpClientConfigTest.java b/src/test/java/io/github/easy4j/opencode/OpenCodeHttpClientConfigTest.java
index 08612d6..d8d0382 100644
--- a/src/test/java/io/github/easy4j/opencode/OpenCodeHttpClientConfigTest.java
+++ b/src/test/java/io/github/easy4j/opencode/OpenCodeHttpClientConfigTest.java
@@ -58,4 +58,32 @@ void shouldKeepLegacySseEventQueueAlias() {
config.setSseEventQueueCapacity(17);
assertEquals(17, config.getStreamEventQueueCapacity());
}
+
+ @Test
+ void aliasesShareCanonicalState() {
+ OpenCodeHttpClientConfig config = new OpenCodeHttpClientConfig();
+ config.setServerUrl("http://legacy:4096");
+ assertEquals("http://legacy:4096", config.getBaseUrl());
+ config.setBaseUrl("http://canonical:4096");
+ assertEquals("http://canonical:4096", config.getServerUrl());
+ config.setStreamEventQueueCapacity(23);
+ assertEquals(23, config.getSseEventQueueCapacity());
+ config.setSseEventQueueCapacity(31);
+ assertEquals(31, config.getStreamEventQueueCapacity());
+ }
+
+ @Test
+ void jsonBindsBothPropertyNamesAndRoundTrips() throws Exception {
+ com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper();
+ for (String names : new String[]{"serverUrl,sseEventQueueCapacity", "baseUrl,streamEventQueueCapacity"}) {
+ String[] properties = names.split(",");
+ String json = "{\"" + properties[0] + "\":\"http://json:4096\",\"" + properties[1] + "\":37}";
+ OpenCodeHttpClientConfig config = mapper.readValue(json, OpenCodeHttpClientConfig.class);
+ assertEquals("http://json:4096", config.getBaseUrl());
+ assertEquals(config.getBaseUrl(), config.getServerUrl());
+ assertEquals(37, config.getStreamEventQueueCapacity());
+ assertEquals(37, config.getSseEventQueueCapacity());
+ assertEquals(config, mapper.readValue(mapper.writeValueAsString(config), OpenCodeHttpClientConfig.class));
+ }
+ }
}