title: Spring boot spark application
body: <p>I am using Spring Boot to implement a spark application. I build an uber jar, and use spark-submit to execute the application. But I got the following exception: </p>
  
  <blockquote>
    <p>18/06/05 15:32:37 ERROR SpringApplication: Application run failed
        org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gsonBuilder' defined in class path resource
    [org/springframework/boot/autoconfigure/gson/GsonAutoConfiguration.class]:
    Bean instantiation via factory method failed; nested exception is
    org.springframework.beans.BeanInstantiationException: Failed to
    instantiate [com.google.gson.GsonBuilder]: Factory method
    'gsonBuilder' threw exception; nested exception is
    java.lang.BootstrapMethod</p>
    
    <p>Error: java.lang.NoSuchMethodError: com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder;
          at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:587)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1254)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1103)
        .....</p>
  </blockquote>
  
  <p>The exception is still there even if I put the following dependency in my <code>pom.xml</code>:</p>
  
  <pre><code>&lt;dependency&gt;
     &lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
     &lt;artifactId&gt;gson&lt;/artifactId&gt;
     &lt;version&gt;2.8.5&lt;/version&gt;
     &lt;scope&gt;compile&lt;/scope&gt;           
  &lt;/dependency&gt;
  </code></pre>
  
  <p>How can I resolve this dependency issue?</p>