From c14e696693765b4545d61d65f90dcac91b3224f8 Mon Sep 17 00:00:00 2001 From: leo james Date: Fri, 12 Jan 2024 11:34:45 +0800 Subject: [PATCH 1/2] init without non-type bean --- .../health/HealthAutoConfiguration.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/HealthAutoConfiguration.java b/sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/HealthAutoConfiguration.java index 7457590cc..0c2da5796 100644 --- a/sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/HealthAutoConfiguration.java +++ b/sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/HealthAutoConfiguration.java @@ -41,17 +41,6 @@ public class HealthAutoConfiguration implements ApplicationContextAware { private ApplicationContext context; - @Bean - public void initEndpoint() { - WebEndpointProperties webEndpointProperties = this.context - .getBean(WebEndpointProperties.class); - WebEndpointProperties.Exposure exposure = webEndpointProperties.getExposure(); - Set includePath = exposure.getInclude(); - includePath.add("*"); - webEndpointProperties.getExposure().setInclude(includePath); - webEndpointProperties.setBasePath("/"); - } - @Bean @ConditionalOnAvailableEndpoint public ArkHealthEndpoint arkHealthEndpoint() { @@ -76,6 +65,13 @@ public MasterBizHealthIndicator masterBizHealthIndicator() { @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + WebEndpointProperties webEndpointProperties = applicationContext.getBean(WebEndpointProperties.class); + WebEndpointProperties.Exposure exposure = webEndpointProperties.getExposure(); + Set includePath = exposure.getInclude(); + includePath.add("*"); + webEndpointProperties.getExposure().setInclude(includePath); + webEndpointProperties.setBasePath("/"); + this.context = applicationContext; } } From 521d1da644c4b9d60157396c9acb5b6e37f8f744 Mon Sep 17 00:00:00 2001 From: leo james Date: Fri, 12 Jan 2024 14:11:32 +0800 Subject: [PATCH 2/2] format --- .../springboot/starter/health/HealthAutoConfiguration.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/HealthAutoConfiguration.java b/sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/HealthAutoConfiguration.java index 0c2da5796..6bcaffc37 100644 --- a/sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/HealthAutoConfiguration.java +++ b/sofa-serverless-runtime/arklet-springboot-starter/src/main/java/com/alipay/sofa/serverless/arklet/springboot/starter/health/HealthAutoConfiguration.java @@ -65,13 +65,14 @@ public MasterBizHealthIndicator masterBizHealthIndicator() { @Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - WebEndpointProperties webEndpointProperties = applicationContext.getBean(WebEndpointProperties.class); + WebEndpointProperties webEndpointProperties = applicationContext + .getBean(WebEndpointProperties.class); WebEndpointProperties.Exposure exposure = webEndpointProperties.getExposure(); Set includePath = exposure.getInclude(); includePath.add("*"); webEndpointProperties.getExposure().setInclude(includePath); webEndpointProperties.setBasePath("/"); - + this.context = applicationContext; } }