Move health autoconfig into health package
This commit moves the health autoconfiguration into its own package as well as moves the ActuatorHealthAdapter into its own class. Signed-off-by: Chris Bono <chris.bono@gmail.com>
This commit is contained in:
@@ -20,18 +20,18 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import io.grpc.ServerBuilder;
|
||||
|
||||
import org.springframework.boot.util.LambdaSafe;
|
||||
import org.springframework.grpc.server.ServerBuilderCustomizer;
|
||||
|
||||
import io.grpc.ServerBuilder;
|
||||
|
||||
/**
|
||||
* Invokes the available {@link ServerBuilderCustomizer} instances in the context for a
|
||||
* given {@link ServerBuilder}.
|
||||
*
|
||||
* @author Chris Bono
|
||||
*/
|
||||
class ServerBuilderCustomizers {
|
||||
public class ServerBuilderCustomizers {
|
||||
|
||||
private final List<ServerBuilderCustomizer<?>> customizers;
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2023-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.grpc.autoconfigure.server.health;
|
||||
|
||||
import org.springframework.boot.actuate.health.HealthContributor;
|
||||
import org.springframework.boot.actuate.health.HealthEndpoint;
|
||||
|
||||
import io.grpc.protobuf.services.HealthStatusManager;
|
||||
|
||||
/**
|
||||
* Adapts {@link HealthContributor Actuator health checks} into gRPC health checks by
|
||||
* periodically invoking {@link HealthEndpoint health endpoints} and updating the health
|
||||
* status in gRPC {@link HealthStatusManager}.
|
||||
*
|
||||
* @author Chris Bono
|
||||
*/
|
||||
public class ActuatorHealthAdapter {
|
||||
|
||||
}
|
||||
@@ -16,9 +16,8 @@
|
||||
* Partial copy from net.devh:grpc-spring-boot-starter.
|
||||
*/
|
||||
|
||||
package org.springframework.grpc.autoconfigure.server;
|
||||
package org.springframework.grpc.autoconfigure.server.health;
|
||||
|
||||
import org.springframework.boot.actuate.health.HealthContributor;
|
||||
import org.springframework.boot.actuate.health.HealthEndpoint;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
@@ -30,6 +29,8 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.grpc.autoconfigure.server.GrpcServerFactoryAutoConfiguration;
|
||||
import org.springframework.grpc.autoconfigure.server.GrpcServerProperties;
|
||||
|
||||
import io.grpc.BindableService;
|
||||
import io.grpc.protobuf.services.HealthStatusManager;
|
||||
@@ -71,13 +72,4 @@ public class GrpcServerHealthAutoConfiguration {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adapts {@link HealthContributor Actuator health checks} into gRPC health checks by
|
||||
* periodically invoking {@link HealthEndpoint health endpoints} and updating the
|
||||
* health status in gRPC {@link HealthStatusManager}.
|
||||
*/
|
||||
static class ActuatorHealthAdapter {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
org.springframework.grpc.autoconfigure.client.GrpcClientAutoConfiguration
|
||||
org.springframework.grpc.autoconfigure.server.GrpcServerFactoryAutoConfiguration
|
||||
org.springframework.grpc.autoconfigure.server.GrpcServerAutoConfiguration
|
||||
org.springframework.grpc.autoconfigure.server.GrpcServerHealthAutoConfiguration
|
||||
org.springframework.grpc.autoconfigure.server.health.GrpcServerHealthAutoConfiguration
|
||||
org.springframework.grpc.autoconfigure.server.GrpcServerObservationAutoConfiguration
|
||||
org.springframework.grpc.autoconfigure.server.GrpcServerReflectionAutoConfiguration
|
||||
org.springframework.grpc.autoconfigure.server.exception.GrpcExceptionHandlerAutoConfiguration
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.grpc.autoconfigure.server;
|
||||
package org.springframework.grpc.autoconfigure.server.health;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
@@ -34,8 +34,9 @@ import org.springframework.boot.ssl.SslBundles;
|
||||
import org.springframework.boot.test.context.FilteredClassLoader;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.grpc.autoconfigure.server.GrpcServerHealthAutoConfiguration.ActuatorHealthAdapter;
|
||||
import org.springframework.grpc.autoconfigure.server.GrpcServerHealthAutoConfiguration.ActuatorHealthAdapterConfiguration;
|
||||
import org.springframework.grpc.autoconfigure.server.GrpcServerFactoryAutoConfiguration;
|
||||
import org.springframework.grpc.autoconfigure.server.ServerBuilderCustomizers;
|
||||
import org.springframework.grpc.autoconfigure.server.health.GrpcServerHealthAutoConfiguration.ActuatorHealthAdapterConfiguration;
|
||||
import org.springframework.grpc.server.lifecycle.GrpcServerLifecycle;
|
||||
import org.springframework.grpc.server.service.GrpcServiceDiscoverer;
|
||||
import org.springframework.util.StringUtils;
|
||||
Reference in New Issue
Block a user