Opened a working project of the company. And there – the
pom.xml files are. One is at the root of the project. A few more are in subfolders.
The question is: do I understand correctly that microservice architecture implies each service -> one folder -> the presence of at least one
pom.xml . ? If not, then what does the presence of several pom.xml in one project in the spring mean in principle?
If the project has several pom.xml files, then we can only say for sure that the project is split into several modules.
These modules can be:
- just the libraries used in the monolith
- separate utilities (for example, a separate program for generating test data)
It is impossible to say unequivocally without looking at what they are and how they interact.
do I understand correctly that microservice architecture implies each service -> one folder -> the presence of at least one pom.xml
One of the important characteristics of a microservice is the possibility of its independent evolution. That is, the ability to make changes to it without affecting other services. This implies a certain degree of isolation of microservices, which is much easier to achieve if the microservices are physically separated, both as they run and in code. And this usually means that each service is separated into at least a separate maven module, and often into a separate repository of the version control system.
But maven is very flexible and allows you to create several working applications from one module (i.e. have one pom.xml, but still multiple services). This removes the artificial barriers that help isolate services, and some might even argue that it makes such an architecture non-microservice.
It should be noted here that microservice architecture is a vague concept. There is a range of possibilities. On one edge a monolith, on the other edge – architecture with all the best practices for creating microservices. But there are also many intermediate forms. And where on this spectrum "microservices are already starting" is a debatable question.