Questions Management – Core Category Service – Create core-category-service project using Spring Tool Suite

Check out the full series of Questions Management tutorial here.

As I said, our Questions Management application will be built in the Microservices model with many different layers. Services related to MongoDB database operations will be grouped into Core Services. In this tutorial, we will create the first Core Service related to the management of the Category that the question will belong to.

First, I will use the Spring Tool Suite to create a new Spring Boot project named core-category-service. You can refer to this tutorial to know how to create a Spring Boot project. For the core-category-service project, there are a few points that I note to you as follows:

In the New Spring Starter Project window, after entering information about our project, the Location section you need to point to the directory that we created in the previous tutorial as follows:

Questions Management - Core Category Service - Create core-category-service project using Spring Tool Suite

Here, the /Users/khanh/Documents/questions-management/ is the directory of the project you created in the previous post. I have added a core folder inside this folder to contain all Core Service projects. And as you see, Packaging, I choose Jar instead of War. 🙂

For the dependencies to use for the core-category-service project, we will use the following dependencies:

Questions Management - Core Category Service - Create core-category-service project using Spring Tool Suite

The result is as follows:

Questions Management - Core Category Service - Create core-category-service project using Spring Tool Suite

Next, I will revise this project a little to make it use the parent project which I created in the previous tutorial.

First, let’s look at the contents of the pom.xml file in the project we just created:

Here, I will move the <parent> and <properties> part of this pom.xml file to the pom.xml file of the parent project so that the services latter of the Questions Management application can reuse those parts or if in the future, we want to increase the version of Spring Boot, we just need to change the parent project only.

The contents of the pom.xml file in the parent project should now look like this:

At this point, I will declare to use the parent project for the project core-category-service as follows:

Here we can declare project core-category-service as a module in the parent project as follows:

Add Comment