* Conditional changes in grpc auto configuration

* Modifier changes in GrpcAutoConfiguraiton for extensibility
This commit is contained in:
Soby Chacko
2023-05-15 18:18:23 -04:00
parent 4655f7089e
commit f4d4eba233
2 changed files with 6 additions and 5 deletions

View File

@@ -20,6 +20,7 @@ import java.util.List;
import io.grpc.BindableService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.function.context.FunctionCatalog;
@@ -37,7 +38,7 @@ import org.springframework.util.StringUtils;
@Configuration(proxyBeanMethods = false)
@EnableConfigurationProperties(FunctionGrpcProperties.class)
@ConditionalOnProperty(name = "spring.cloud.function.grpc.server", havingValue = "true", matchIfMissing = true)
class GrpcAutoConfiguration {
public class GrpcAutoConfiguration {
@Bean
public GrpcServer grpcServer(FunctionGrpcProperties grpcProperties, BindableService[] grpcMessagingServices) {
@@ -53,8 +54,9 @@ class GrpcAutoConfiguration {
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@SuppressWarnings("rawtypes")
@Bean
@ConditionalOnMissingBean
public BindableService grpcSpringMessageHandler(MessageHandlingHelper helper) {
return new GrpcServerMessageHandler(helper);
}

View File

@@ -70,7 +70,7 @@ import com.google.protobuf.GeneratedMessageV3;
*
*/
@SuppressWarnings("rawtypes")
class GrpcServerMessageHandler extends MessagingServiceImplBase {
public class GrpcServerMessageHandler extends MessagingServiceImplBase {
private Log logger = LogFactory.getLog(GrpcServerMessageHandler.class);
@@ -78,8 +78,7 @@ class GrpcServerMessageHandler extends MessagingServiceImplBase {
private boolean running;
GrpcServerMessageHandler(MessageHandlingHelper<GeneratedMessageV3> helper) {
public GrpcServerMessageHandler(MessageHandlingHelper<GeneratedMessageV3> helper) {
this.helper = helper;
}