diff --git a/hippo4j-common/src/main/java/cn/hippo4j/common/model/WebIpAndPortInfo.java b/hippo4j-common/src/main/java/cn/hippo4j/common/model/WebIpAndPortInfo.java index a2dce703..b2b101c1 100644 --- a/hippo4j-common/src/main/java/cn/hippo4j/common/model/WebIpAndPortInfo.java +++ b/hippo4j-common/src/main/java/cn/hippo4j/common/model/WebIpAndPortInfo.java @@ -21,17 +21,22 @@ import lombok.Data; import lombok.extern.slf4j.Slf4j; /** - * web ip and port info + * Web ip and port info */ @Data @Slf4j public class WebIpAndPortInfo { protected static final String ALL = "*"; + protected static final String SPOT = "\\."; + protected static final String COLON = ":"; + private String ip; + private String port; + private String[] ipSegment; public WebIpAndPortInfo(String ip, String port) { @@ -53,7 +58,7 @@ public class WebIpAndPortInfo { } /** - * check + * Check. * * @param appIpSegment application ip segment * @param port application port @@ -63,7 +68,7 @@ public class WebIpAndPortInfo { } /** - * check ip + * Check ip. * * @param appIpSegment application ip segment */ @@ -81,7 +86,7 @@ public class WebIpAndPortInfo { } /** - * check port + * Check port. * * @param port application port */ @@ -90,7 +95,7 @@ public class WebIpAndPortInfo { } /** - * Check whether the strings are the same + * Check whether the strings are the same. * * @param appIp appIp * @param propIp propIp diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/AbstractRefreshListener.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/AbstractRefreshListener.java index 5a8c9468..a630db60 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/AbstractRefreshListener.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/event/AbstractRefreshListener.java @@ -36,10 +36,11 @@ import java.util.Objects; public abstract class AbstractRefreshListener implements RefreshListener { protected static final String ALL = "*"; + protected static final String SEPARATOR = ","; /** - * application ip and application post + * Application ip and application post */ protected static volatile WebIpAndPortInfo webIpAndPort; @@ -60,7 +61,7 @@ public abstract class AbstractRefreshListener implements RefreshListener implements RefreshListener i.check(webIpAndPort.getIpSegment(), webIpAndPort.getPort())); + .anyMatch(each -> each.check(webIpAndPort.getIpSegment(), webIpAndPort.getPort())); } /** - * get nodes in new properties + * Get nodes in new properties. * * @param properties new properties * @return nodes in properties @@ -105,5 +106,4 @@ public abstract class AbstractRefreshListener implements RefreshListener