When building micro-services for a huge system that can be clearly broken down into sub-domains, should I structure my spring boot java folders by:
Example structure Case 1:
For a location micro-service, entities could be country, region and city. The project structure will look like this
Case 2: The project structure will look like this
The answer to your question is very contextual and may differ in different organizations. However, it really boils down on which one is easier for you to manage and how complex is your application.
Going for case 1 means that it will be easier to find related components together. However, it becomes difficult to manage entities that mean different in different contexts (User in authentication can be a buyer in a retail shop).
Going for case 2 solves the problem that I suggested below and it allows you to maintain your application by changing one whole layer instead of diving to each folders.