I've been working on Spring Boot projects for about two years and I'm diving into microservices now, but I'm really confused about implementing an API gateway. I understand what it is, but every tutorial I find seems to be different. Some suggest using a reactive gateway even if my APIs aren't reactive, while others promote a regular gateway. I've seen recommendations for routing services in Java code instead of using properties, and there are differences in the import names—some suggest using 'spring-cloud-starter-gateway' and others 'spring-cloud-starter-gateway-server-webflux' or 'spring-cloud-starter-gateway-server-webmvc'. My Eureka setup is working fine, and Kafka is straightforward for me, but this whole gateway situation is stressing me out. Can anyone share their experiences or implementations?
1 Answer
It can be frustrating that Spring seems to push the reactive route hard. It adds complexity for many use cases. But know that apart from handling simpler operations well, it also appropriately sets HTTP request headers, which is crucial if you're using JWT tokens or any type of authentication. Also, be aware that many tutorials are outdated, which can make learning tougher. Best of luck!
Actually, Spring started allowing a blocking version with virtual threads, so they aren’t pushing reactive as hard anymore unless it's necessary.

Is that still relevant with the advent of virtual threads? Last I heard, there hasn't been much talk about Webflux since Java 21 came out.