Skip to content

Commit b8f328b

Browse files
🎨【微信开放平台】优化 Spring Boot Starter 配置逻辑
1 parent f351ecf commit b8f328b

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

spring-boot-starters/wx-java-open-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/open/config/storage/AbstractWxOpenConfigStorageConfiguration.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,20 @@
99
public abstract class AbstractWxOpenConfigStorageConfiguration {
1010

1111
protected WxOpenInMemoryConfigStorage config(WxOpenInMemoryConfigStorage config, WxOpenProperties properties) {
12-
WxOpenProperties.ConfigStorage configStorageProperties = properties.getConfigStorage();
12+
WxOpenProperties.ConfigStorage storage = properties.getConfigStorage();
1313
config.setWxOpenInfo(properties.getAppId(), properties.getSecret(), properties.getToken(), properties.getAesKey());
14-
config.setHttpProxyHost(configStorageProperties.getHttpProxyHost());
15-
config.setHttpProxyUsername(configStorageProperties.getHttpProxyUsername());
16-
config.setHttpProxyPassword(configStorageProperties.getHttpProxyPassword());
17-
if (configStorageProperties.getHttpProxyPort() != null) {
18-
config.setHttpProxyPort(configStorageProperties.getHttpProxyPort());
14+
config.setHttpProxyHost(storage.getHttpProxyHost());
15+
config.setHttpProxyUsername(storage.getHttpProxyUsername());
16+
config.setHttpProxyPassword(storage.getHttpProxyPassword());
17+
Integer httpProxyPort = storage.getHttpProxyPort();
18+
if (httpProxyPort != null) {
19+
config.setHttpProxyPort(httpProxyPort);
1920
}
20-
int maxRetryTimes = configStorageProperties.getMaxRetryTimes();
21-
if (configStorageProperties.getMaxRetryTimes() < 0) {
21+
int maxRetryTimes = storage.getMaxRetryTimes();
22+
if (maxRetryTimes < 0) {
2223
maxRetryTimes = 0;
2324
}
24-
int retrySleepMillis = configStorageProperties.getRetrySleepMillis();
25+
int retrySleepMillis = storage.getRetrySleepMillis();
2526
if (retrySleepMillis < 0) {
2627
retrySleepMillis = 1000;
2728
}

0 commit comments

Comments
 (0)