关于Gateway与JHipster UAA是否需连接JHipster-register的问询
Great question! The short answer is yes, both your Gateway and JHipster UAA service should connect to the JHipster Registry—here's why, tied to the architecture diagram you referenced:
Service Discovery is core to the microservices flow
The JHipster Registry acts as your Eureka server, the backbone of service discovery in a JHipster microservices setup. Your Gateway needs to locate the UAA service dynamically to handle authentication requests, and while UAA might seem like a standalone auth service, it still benefits from being registered: if you ever add other microservices that need to validate tokens against UAA (like resource services), those services will also use the Registry to find UAA. Hardcoding UAA's address in the Gateway defeats the flexibility of microservices.The architecture diagram confirms this
In the official JHipster UAA architecture, the UAA service is explicitly shown as a registered service within the Registry. The Gateway doesn't talk directly to UAA via a fixed URL—it queries the Registry to find the UAA instance(s) available, which is critical for scaling (e.g., if you run multiple UAA instances for high availability).JHipster's generator enforces this best practice
When you generate a UAA service using JHipster, the generator will prompt you to connect to a JHipster Registry. Choosing "yes" configures the UAA as an Eureka client automatically, just like the Gateway. Skipping this would force you to manually configure the Gateway with a static UAA URL, which is not recommended for production environments where service instances might come and go.Bonus: Unified configuration management
The JHipster Registry also doubles as a Spring Cloud Config server. By connecting both Gateway and UAA to it, you can manage all their configuration (like database settings for UAA, routing rules for Gateway) in a single place, with dynamic updates without restarting services.
内容的提问来源于stack exchange,提问作者Cesar Manuel

