title: How to avoid putting a specific version of Spring Boot in a library
body: <p>I am developing a library based on Spring Boot, which could be used in multiple Spring Boot applications. The library is supposed to work with Spring Boot <code>1.3.0.M1</code> onwards.</p>
  
  <p>I was thinking how to avoid putting a specific version of Spring JARs in it, and instead let the application specify the exact version. Currently I have come out with this solution, which seems to work except with certain combinations:</p>
  
  <ol>
  <li><p>In the library, have the Spring Boot version as <code>1.3.0.M1</code>, and have the scope of all the dependencies as <code>provided</code>. Like this:</p>
  
  <pre><code>...
  &lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;1.3.0.M1&lt;/version&gt;
      &lt;relativePath/&gt;
  &lt;/parent&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  ...
  </code></pre></li>
  <li><p>In the application, mention the actual Spring Boot version, e.g. <code>1.3.0.M3</code>, and re-include all the dependencies, like this:</p>
  
  <pre><code>...
  &lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;1.3.0.M3&lt;/version&gt;
      &lt;relativePath/&gt;
  &lt;/parent&gt;
  
  &lt;dependencies&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
      &lt;/dependency&gt;
   ...
  </code></pre></li>
  </ol>
  
  <p>When I run the application with this <code>1.3.0.M1</code>+<code>1.3.0.M3</code> specific combination, I'm getting this error, which I think is just some compatibility issue:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoSuchMethodError: org.springframework.core.ResolvableType.forInstance(Ljava/lang/Object;)Lorg/springframework/core/ResolvableType;
  </code></pre>
  
  <p>However, experimenting with stable releases, e.g. when I set the lib version to <code>1.2.0.RELEASE</code> and the app version to <code>1.2.5.RELEASE</code>, it works.</p>
  
  <p>So, I was wondering whether this would be the right way to handle such scenario, or there is a better way.</p>