diff --git a/commons/common-util/src/main/java/com/schbrain/common/util/IpAddressHolder.java b/commons/common-util/src/main/java/com/schbrain/common/util/IpAddressHolder.java
index c989e6700a37e92b0b3afaebccac357651010b83..6b52bcfcab815481ebc05a1b3b0f0f0841131bd0 100644
--- a/commons/common-util/src/main/java/com/schbrain/common/util/IpAddressHolder.java
+++ b/commons/common-util/src/main/java/com/schbrain/common/util/IpAddressHolder.java
@@ -17,8 +17,12 @@ public class IpAddressHolder {
private static final String POD_IP = System.getenv("POD_IP");
private static final String LOCAL_IP = Optional.ofNullable(findFirstNonLoopBackAddress()).map(InetAddress::getHostAddress).orElse("127.0.0.1");
- public static String getIpAddress() {
- return POD_IP == null ? LOCAL_IP : POD_IP;
+ public static String getLocalIp() {
+ return getLocalIp(LOCAL_IP);
+ }
+
+ public static String getLocalIp(String fallback) {
+ return POD_IP == null ? fallback : POD_IP;
}
private static InetAddress findFirstNonLoopBackAddress() {
diff --git a/pom.xml b/pom.xml
index 1808b63a31ce57492593da6c631cc484102667f8..076c8a5913916fabb1cbeaaccb35699a3f9b0027 100644
--- a/pom.xml
+++ b/pom.xml
@@ -87,7 +87,6 @@
5.3.3
3.18.0
9.0.0
- 2.7.11
0.10.4
2.0.2
3.9.1
@@ -423,16 +422,6 @@
apm-toolkit-logback-1.x
${skywalking-tooklit.version}
-
- de.codecentric
- spring-boot-admin-starter-server
- ${spring-boot-admin.version}
-
-
- de.codecentric
- spring-boot-admin-starter-client
- ${spring-boot-admin.version}
-
io.vavr
vavr
diff --git a/starters/logger-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/logger/JSONLoggingInitializer.java b/starters/logger-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/logger/JSONLoggingInitializer.java
index 92705cbd361e4dc1e9a20dbf6b5863ae3fbfbddc..75eb0cfab20caf7e92ae2ff9f6a3fd9b548b49e7 100644
--- a/starters/logger-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/logger/JSONLoggingInitializer.java
+++ b/starters/logger-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/logger/JSONLoggingInitializer.java
@@ -127,7 +127,7 @@ public class JSONLoggingInitializer {
private String getCustomFields() {
JSONObject customFields = new JSONObject();
customFields.set("appName", applicationName);
- customFields.set("podIp", IpAddressHolder.getIpAddress());
+ customFields.set("podIp", IpAddressHolder.getLocalIp());
return customFields.toString();
}
diff --git a/starters/logger-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/logger/listener/LoggingConfigLoadedEventListener.java b/starters/logger-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/logger/listener/LoggingConfigLoadedEventListener.java
index 298a8a66d77d8ae1004f19d1234d2167ff4fa9cb..661a854fe5efb3536e1c8b2050c5d85e63121adf 100644
--- a/starters/logger-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/logger/listener/LoggingConfigLoadedEventListener.java
+++ b/starters/logger-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/logger/listener/LoggingConfigLoadedEventListener.java
@@ -44,7 +44,7 @@ public class LoggingConfigLoadedEventListener extends ConfigLoadedEventListenerA
* hostInfo properties, for logging pattern, used in logback-spring.xml
*/
private Map buildIpAddressProperties() {
- return Map.of("application.ipAddress", IpAddressHolder.getIpAddress());
+ return Map.of("application.ipAddress", IpAddressHolder.getLocalIp());
}
/**
diff --git a/starters/xxl-job-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/xxl/properties/XxlJobProperties.java b/starters/xxl-job-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/xxl/properties/XxlJobProperties.java
index 8e2475652b1a912cf5ace1397374e5b9829ec08a..af4b2915b2e607a58569561913079be705739f35 100644
--- a/starters/xxl-job-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/xxl/properties/XxlJobProperties.java
+++ b/starters/xxl-job-spring-boot-starter/src/main/java/com/schbrain/framework/autoconfigure/xxl/properties/XxlJobProperties.java
@@ -15,7 +15,7 @@ public class XxlJobProperties implements ConfigurableProperties {
private String adminAddresses;
- private String ip = IpAddressHolder.getIpAddress();
+ private String ip = IpAddressHolder.getLocalIp();
private int port = -1;
diff --git a/support/schbrain-spring-support/pom.xml b/support/schbrain-spring-support/pom.xml
index d7de96b94d59d208adb3dd21a7680e603ba74921..ca7b4e343ed907c5f6f27730c464396d2cd9466a 100644
--- a/support/schbrain-spring-support/pom.xml
+++ b/support/schbrain-spring-support/pom.xml
@@ -24,20 +24,16 @@
org.springframework.boot
- spring-boot-starter-web
+ spring-boot-starter-actuator
- org.springframework.boot
- spring-boot-starter-actuator
+ io.micrometer
+ micrometer-registry-prometheus
org.springframework.boot
spring-boot-configuration-processor
-
- de.codecentric
- spring-boot-admin-starter-client
-
org.springframework.boot
spring-boot-properties-migrator
diff --git a/support/schbrain-spring-support/src/main/java/com/schbrain/framework/support/spring/admin/AdminApplicationFactory.java b/support/schbrain-spring-support/src/main/java/com/schbrain/framework/support/spring/admin/AdminApplicationFactory.java
deleted file mode 100644
index e8d028b73647d6092f56af6a04fafead66a92479..0000000000000000000000000000000000000000
--- a/support/schbrain-spring-support/src/main/java/com/schbrain/framework/support/spring/admin/AdminApplicationFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.schbrain.framework.support.spring.admin;
-
-import com.schbrain.common.util.IpAddressHolder;
-import de.codecentric.boot.admin.client.config.InstanceProperties;
-import de.codecentric.boot.admin.client.registration.ServletApplicationFactory;
-import de.codecentric.boot.admin.client.registration.metadata.MetadataContributor;
-import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties;
-import org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties;
-import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints;
-import org.springframework.boot.autoconfigure.web.ServerProperties;
-import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPath;
-
-import javax.servlet.ServletContext;
-
-/**
- * @author liaozan
- * @since 2023/10/26
- */
-public class AdminApplicationFactory extends ServletApplicationFactory {
-
- public AdminApplicationFactory(InstanceProperties instance, ManagementServerProperties management,
- ServerProperties server, ServletContext servletContext, PathMappedEndpoints pathMappedEndpoints,
- WebEndpointProperties webEndpoint, MetadataContributor metadataContributor,
- DispatcherServletPath dispatcherServletPath) {
- super(instance, management, server, servletContext, pathMappedEndpoints, webEndpoint, metadataContributor, dispatcherServletPath);
- }
-
- @Override
- protected String getServiceHost() {
- return IpAddressHolder.getIpAddress();
- }
-
- @Override
- protected String getManagementHost() {
- return IpAddressHolder.getIpAddress();
- }
-
-}
diff --git a/support/schbrain-spring-support/src/main/java/com/schbrain/framework/support/spring/admin/SpringBootAdminFeatureAutoConfiguration.java b/support/schbrain-spring-support/src/main/java/com/schbrain/framework/support/spring/admin/SpringBootAdminFeatureAutoConfiguration.java
deleted file mode 100644
index 49efe240dd164e0e519262744009214ac4e50ec4..0000000000000000000000000000000000000000
--- a/support/schbrain-spring-support/src/main/java/com/schbrain/framework/support/spring/admin/SpringBootAdminFeatureAutoConfiguration.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.schbrain.framework.support.spring.admin;
-
-import de.codecentric.boot.admin.client.config.InstanceProperties;
-import de.codecentric.boot.admin.client.config.SpringBootAdminClientAutoConfiguration;
-import de.codecentric.boot.admin.client.registration.ApplicationFactory;
-import de.codecentric.boot.admin.client.registration.metadata.MetadataContributor;
-import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties;
-import org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties;
-import org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints;
-import org.springframework.boot.autoconfigure.AutoConfiguration;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnCloudPlatform;
-import org.springframework.boot.autoconfigure.web.ServerProperties;
-import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPath;
-import org.springframework.boot.cloud.CloudPlatform;
-import org.springframework.context.annotation.Bean;
-
-import javax.servlet.ServletContext;
-
-/**
- * @author liaozan
- * @since 2023/10/26
- */
-@AutoConfiguration(before = SpringBootAdminClientAutoConfiguration.class)
-@ConditionalOnCloudPlatform(CloudPlatform.KUBERNETES)
-public class SpringBootAdminFeatureAutoConfiguration {
-
- @Bean
- public ApplicationFactory applicationFactory(InstanceProperties instance, ManagementServerProperties management,
- ServerProperties server, ServletContext servletContext, PathMappedEndpoints pathMappedEndpoints,
- WebEndpointProperties webEndpoint, MetadataContributor metadataContributor,
- DispatcherServletPath dispatcherServletPath) {
- return new AdminApplicationFactory(instance, management, server, servletContext, pathMappedEndpoints, webEndpoint, metadataContributor, dispatcherServletPath);
- }
-
-}
diff --git a/support/schbrain-spring-support/src/main/java/com/schbrain/framework/support/spring/env/DefaultPropertiesEnvironmentPostProcessor.java b/support/schbrain-spring-support/src/main/java/com/schbrain/framework/support/spring/env/DefaultPropertiesEnvironmentPostProcessor.java
index 0b0ba2c7d53d3feb2a4ba01098da8e1b489d34bc..dd2694583c8a1dbdb09eba36ef12249ed0a634e7 100644
--- a/support/schbrain-spring-support/src/main/java/com/schbrain/framework/support/spring/env/DefaultPropertiesEnvironmentPostProcessor.java
+++ b/support/schbrain-spring-support/src/main/java/com/schbrain/framework/support/spring/env/DefaultPropertiesEnvironmentPostProcessor.java
@@ -68,9 +68,6 @@ public class DefaultPropertiesEnvironmentPostProcessor extends LoggerAwareEnviro
defaultProperties.put("spring.main.allow-circular-references", true);
defaultProperties.put("spring.main.banner-mode", Banner.Mode.OFF.name());
defaultProperties.put("server.shutdown", Shutdown.GRACEFUL.name());
- if (EnvUtils.runningOnCloudPlatform(environment)) {
- defaultProperties.put("spring.boot.admin.client.url", "http://spring-boot-admin-server.devops:8019");
- }
DefaultPropertiesPropertySource.addOrMerge(defaultProperties, environment.getPropertySources());
}
diff --git a/support/schbrain-spring-support/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/support/schbrain-spring-support/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
index 31bc5acd793369d4c1ddb42ac33415e1a01049a4..89f8c313d0cd4186ed980484f0a119edb1961ef9 100644
--- a/support/schbrain-spring-support/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
+++ b/support/schbrain-spring-support/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -1,3 +1,2 @@
-com.schbrain.framework.support.spring.admin.SpringBootAdminFeatureAutoConfiguration
com.schbrain.framework.support.spring.elasticsearch.ElasticsearchFeatureAutoConfiguration
com.schbrain.framework.support.spring.redisson.RedissonFeatureAutoConfiguration