[英]How to make the Jhipster gateway REST requests the microservice?
In order to learn the awesome JHipster framework I'm trying to implement a simple jhipster microservice architecture in order to have the gateway REST request the microservice and the microservice request the database. 为了学习很棒的JHipster框架,我试图实现一个简单的jhipster微服务架构,以使网关REST请求微服务,而微服务请求数据库。
Firstly, I generate a microservice application (backend port 8081), a microservice gateway (frontend port 8080) and clone the jhipster registry. 首先,我生成一个微服务应用程序(后端端口8081),一个微服务网关(前端端口8080)并克隆jhipster注册表。 Secondly, I import the same jdl in both microservice and gateway.
其次,我在微服务和网关中都导入了相同的jdl。 I've implemented an AppLoading component to populate the database in the backend.
我已经实现了一个AppLoading组件,以在后端填充数据库。
I've already tried to : 我已经尝试过:
My code is available on github: 我的代码在github上可用:
I launch all of them (with mvnw command) and all seems ok: 我启动了所有它们(使用mvnw命令),并且一切正常:
But, no backend data are available in the gateway. 但是,网关中没有后端数据可用。 The gateway communicate with its owm h2 database port 8080 and doesn't REST request for the backend which owns my data!
网关与其owm h2数据库端口8080通信,并且不对拥有我的数据的后端进行REST请求!
My questions are : 我的问题是:
I tried to give all the necessary information but ask me if something is missing. 我试图提供所有必要的信息,但问我是否缺少某些东西。
Thanks a lot :-) 非常感谢 :-)
You need to specify the microservice
name in the JDL. 您需要在JDL中指定
microservice
名称。 Currently, you generated the entities in both the gateway and microservice. 当前,您在网关和微服务中都生成了实体。 When you specify the microservice name, the gateway will only generate the frontend code.
当您指定微服务名称时,网关将仅生成前端代码。 Here's an example:
这是一个例子:
entity A
entity B
microservice * with backend
https://www.jhipster.tech/jdl/#microserviceoptions https://www.jhipster.tech/jdl/#microserviceoptions
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.