Questions Management – Support Discovery Server – Initialize support-discovery-server project using the Spring Tool Suite

Check out the full series of Questions Management tutorial here.

Managing and monitoring services in a Microservices system is very important to ensure that our application can operate smoothly. To do this, we first need a place that can be used to register information about services and manage them. For services in the Questions Management application, I will use Spring Cloud Netflix with Eureka Server to do this. In this tutorial, I will go through some important steps in the process of creating support-discovery-server Spring Boot project for this purpose.

In the New Spring Starter Project window, after filling in the information for our project, the Location section should point to the questions-management project folder:

Questions Management - Initialize support-discovery-server project using the Spring Tool Suite

As you can see in the questions-management project folder, I have added a support folder inside this folder to hold all the projects involved in supporting the management and monitoring of services in our Questions Management application.

In the dependencies section for the support-discovery-server project, we only need one dependency, the Spring Cloud Netflix Eureka Server, as follows:

Questions Management - Initialize support-discovery-server project using the Spring Tool Suite

You can read more about the Eureka Server here to understand more.

Result:

Questions Management - Initialize support-discovery-server project using the Spring Tool Suite

Next, I will revise this project so that it uses the parent project of the questions-management project.

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

I’ll move the <dependencyManagement> and the <spring-cloud.version> section to the questions-management project pom.xml file for future Spring Cloud projects, then delete the <parent>, the <properties>, the <repositories> section for declarations using the questions-management parent project as follows:

At this point, you will see an error in the pom.xml file related to not finding the dependency for the Spring Cloud:

Questions Management - Initialize support-discovery-server project using the Spring Tool Suite

This is because I removed the <repositories> section of this pom.xml file.

The reason I removed the <repositories> section was because I wanted to define all the repositories needed for the questions-management project in the settings.xml file in the Apache Maven “<user.home>/.m2/” directory. This is very useful for future deployment of Questions Management application.

If you do not know how to define the settings.xml file, you can refer my settings.xml file, as follows:

Finally, I will declare the support-discovery-server project as a module of the questions-management project as follows:

Add Comment