Q:

Springboot create a library from my model and repository classes

I could not find a answer to this question so if there is I'm sorry for repeating question.
I have 4 springboot apps (MICRO SERVICES ??), we have our main CRM on Oracle database running on Apex. Now over time Ive been trying to break it up. So I created some spring-boot apps for example I have one that is for google services eg: geo codeding, place searching etc. I have one that is for connecting our CRM to Xero online accounting service API and 3rd one that is running web-socket server so we can push messages to users of Oracle Apex. 
Now in all the projects I'm connecting to the same database so I have 4 copies of my Model and Repository classes. 
What I would like to do is to create a jar that has them and then share it across the projects. Now I can create a library but as I need to have spring deps in the library. 
I created this as my gradle.build 
buildscript {
    ext {
        springBootVersion = '1.5.10.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'

group = 'com.example'
version = '0.0.1'
sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    compile('org.springframework.boot:spring-boot-actuator-docs')
    compile('org.springframework.boot:spring-boot-starter-actuator')
    compile('org.springframework.boot:spring-boot-starter-data-jpa')
    compile('org.springframework.boot:spring-boot-starter-data-rest')
    compile('org.springframework.data:spring-data-rest-hal-browser')
    runtime('org.springframework.boot:spring-boot-devtools')
    compileOnly('org.springframework.boot:spring-boot-configuration-processor')
    compileOnly('org.projectlombok:lombok')
    testCompile('org.springframework.boot:spring-boot-starter-test')
}

But I get a error if I don't have a application class with @SpringbootApplication annotation. 
I'm sure I'm missing something but I need to create a jar library with spring JPARepositories.

A:

Considering that you only want to use that library for your entities and repositories, you don't actually need Spring boot and can create a library using Spring only.
Just add the dependencies you need, in your case probably just spring-data-jpa (or alternatively, spring-boot-starter-data-jpa):
<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-jpa</artifactId>
</dependency>

If you'd like to use the dependency management that Spring boot offers out of the box, you can still use it:
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>1.5.7.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

Now you can build it using the nomal Maven JAR plugin, rather than the Spring boot plugin.

