Structure and configuration of the project for microservices


Please ignore English grammar.

For Learning purpose I want to create a microservice project in Spring and I download some sample project and now I have some very basic idea of microservices. But I am confused how I start my own project. I want to implement the following simple use case.

In my database I have three table Product, ProductStock and Order and I want to write microservice for each table.

Product microservice will have end point for crud operation. ProductStock microservice will only have update stock and check stock end point. Order microservice will only have posting order operation.

I create a multi module maven project and now I have following question.

1: Is creating multi module maven project is the only way to create microservices project.

2: I am using Hibernate so in which module(microservice) I create model classes. I need model classes in every module(microservice). (Model classes are Product, ProductStock and Order).

3: Where I set hibernate confiuration.

The microservice architecture is not a trivial area so I would suggest to you that you start with some theory first. One of the books which is often referred here and there is Building Microservices By Sam Neuman. I highly recommend reading it or at least a part of it. This is the theoretical part.

Then for some hands on experiences you may want to clone/fork the PiggyMetrics project. This is an educational project but at the same time it contains quite a lot of patterns and advanced stuff.

After that you will be able to answer your own questions yourself, albeit there will be much more to ask ;-)

Good luck!