grpc-spring icon indicating copy to clipboard operation
grpc-spring copied to clipboard

Sharing spring boot web netty container

Open hyeluoh opened this issue 4 years ago • 5 comments

When I use spring-cloud-starter-zookeeper-discovery that it depend on spring-boot-starter-web, it happens there are two netty contariners. There are two server port that one is server port default by springboot ,one is grpc.port.I want to retain one netty container, Could it be adopted?

hyeluoh avatar Mar 23 '21 09:03 hyeluoh

Maybe, but I don't know how. (But it sounds like a good option)

ST-DDT avatar Mar 23 '21 17:03 ST-DDT

new SpringApplicationBuilder(Application.class)
  .web(WebApplicationType.NONE)
  .run(args);

Maybe something like this would work?

bound2 avatar Nov 17 '21 12:11 bound2

new SpringApplicationBuilder(Application.class)
  .web(WebApplicationType.NONE)
  .run(args);

Maybe something like this would work?

This prevents the web server from starting, it does not expose or reuse either of the web-netty or grpc-netty.

ST-DDT avatar Nov 17 '21 13:11 ST-DDT

Tried it with https://github.com/hojongs/kotlin-spring-boot-grpc-example and it seemed to stay in started state. Didn't test endpoints themselves.

E: but of course it uses different implementation of spring boot grpc starter

bound2 avatar Nov 17 '21 17:11 bound2

According to the README, that one will also run on two ports. Am I missing something here?

whiskeysierra avatar Nov 17 '21 17:11 whiskeysierra