Q:

Add spring boot application as dependency to another spring boot application

I have a spring boot application A which is a spring data service to do some CRUD operations. Now I wanted to add this A as dependency to another Spring boot application B which is just a rest service to access various methods of A. When I did that and started B's Application class, I see the application A getting run and all the configurations are done and stops. What I wanted to achieve is application B should run a tomcat on pot 8080 so that I could access application B's CRUD methods. Could someone please help me to achieve this?
Before writing this question I did search the forum for all relevant threads but could not find a solution.

A:

I have a spring boot application A which is a spring data service to
  do some CRUD operations. Now I wanted to add this A as dependency to
  another Spring boot application B which is just a rest service to
  access various methods of A.

According to the described need, I am not sure you need to have two Spring Boot applications.
Having two distinct Spring Boot web based applications assumes that the two applications need to be physically separated. This separation has a cost since you have to make a way to allow the applications to communicate between them : webservice, jms, rmi, jms, etc... and you have to develop and maintain two Spring Boot applications, but you said that 

Spring boot application B which is just a rest service to access
  various methods of A

If you want to call repository methods of A in a straight way from rest services of B, why having two distinct applications and make it more complex ? 
A single Spring Boot application with multiple modules could be more suitable and maintainable solution:
- parent-my-app (super and parent project)
|
|----> repository-my-app module
|     
|   
|----> rest-my-app module    
                    |----> dependency on repository-my-app module  

To conclude, strongly decoupling the communication between two layers via two applications has a cost and coping with two Spring Boot application too.
So, if you don't really need it, you should avoid.

