Missing User class - creating entity relationship to User entity in Microservice

谁说我不能喝 提交于 2019-12-04 12:46:50

In a JHipster microservice architecture, the User entity is located on the gateway or UAA service.

Profile Entity

In the UAA, you can create an entity with a relationship to the user. Adding additional information such as a profile to the entity is a good use case for this. Doing the same thing in a gateway is also possible. An example UAA that creates an entity with a relationship to the user can be seen https://github.com/xetys/microxchng-workshop/tree/master/uaa

Blog Entity

Using the entity sub-generator works a little bit differently in a microservices architecture, as the front-end and the back-end codes are not located in the same application. https://jhipster.github.io/microservices-architecture/#generating_entities

For this type of entity, I recommend storing the user's ID along with the entity. You will need to pass the user ID from the client as the ID is not easily accessible from a microservice. The reason we use the user ID instead of login is that the login can be modified through the User Management pages, causing the relationships to be fail (from the old login value).

The other option is to use the userLogin, which is accessible in a microservice through SecurityUtils.java. As long as you handle that the login can change, this is another option.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!