I created a spring boot application having REST web services and jpa dependencies. The application runs on its own as a standalone application. I'm trying to add UI layer using vaadin as a separate project that uses the services from the sring boot project. Is there an easy way to make the spring boot application as a library jar that can be included in other projects.
I searched the forum and found some threads that advised not using spring boot but instead using the spring framework to create the library. Just wanted to check if there are any examples how this can be done in Spring boot.
Like Morphic said, you need to decide whether you're going to call the library methods natively using Java or whether you're setting up a web service. It sounds like you're building a REST API, in which case I wouldn't bother including it as a library. I would simply run your spring boot application (java -jar myservice.jar, or mvn spring:boot run), then just connect to it using HTTP REST on whatever port Spring Boot opens for your service.
If you do decide to load the Spring Boot app as a library jar then you probably don't need Spring boot at all. All you need is your service methods and Spring config packaged together as a jar, mvn install to your local repo, then just reference your jar in the vaadin project's pom file (all this assuming you're creating it as a maven project).
This project of mine may be of some interest to you. I have used Spring-Boot to make a library to be used in other projects.
The main thing to note here is to have:
in the main class where you start the spring-boot application. See this main class to learn more. But to be honest, using Spring-Boot to make a library to be included in other projects isn't a good choice according to me. If I were to rewrite JBot then I wouldn't have used Spring-Boot this way surely.
If your intention was to let Vaadin call the REST API you've created from the browser (as is usually the case with client-side frameworks like AngularJS), then you're misunderstanding Vaadin. A Vaadin application runs server-side.
So what you can do is run two servers, one running the Vaadin application and which calls the second one running your REST API. But if there's no need for this split, you can use the classes that form the REST API as a regular Java API called directly from the Vaadin application code.