title: Add Cloud Firestore to Spring Boot REST API. Error creating bean with name 'firebaseJwtDelegatingValidator'
body: <p>I am trying to setup a Spring Boot REST API that connects to Google Cloud Firestore.</p>
  
  <p>Following this <a href="https://cloud.spring.io/spring-cloud-static/spring-cloud-gcp/1.2.0.M1/#_cloud_firestore" rel="nofollow noreferrer">guide</a> it looked simple enough but I quickly found of that there is stuff not mentioned here that needs to be done to run locally such as manually adding the json credentials file to the project. </p>
  
  <p>I have run into an issue now when trying to run the API where it says it cannot create a bean <code>firebaseJwtDelegatingValidator</code></p>
  
  <pre><code>2020-04-12 22:29:15.850  WARN 71462 --- [           main] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'firebaseJwtDelegatingValidator' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/security/FirebaseAuthenticationAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.core.DelegatingOAuth2TokenValidator]: Factory method 'firebaseJwtDelegatingValidator' threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/cloud/gcp/security/firebase/FirebaseTokenValidator
  2020-04-12 22:29:15.867  INFO 71462 --- [           main] ConditionEvaluationReportLoggingListener : 
  
  Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
  2020-04-12 22:29:15.875 ERROR 71462 --- [           main] o.s.boot.SpringApplication               : Application run failed
  
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'firebaseJwtDelegatingValidator' defined in class path resource [org/springframework/cloud/gcp/autoconfigure/security/FirebaseAuthenticationAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.core.DelegatingOAuth2TokenValidator]: Factory method 'firebaseJwtDelegatingValidator' threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/cloud/gcp/security/firebase/FirebaseTokenValidator
      at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
      at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:882) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
      at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:66) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.2.6.RELEASE.jar:2.2.6.RELEASE]
  Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.core.DelegatingOAuth2TokenValidator]: Factory method 'firebaseJwtDelegatingValidator' threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/cloud/gcp/security/firebase/FirebaseTokenValidator
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
      at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
      ... 19 common frames omitted
  Caused by: java.lang.NoClassDefFoundError: org/springframework/cloud/gcp/security/firebase/FirebaseTokenValidator
      at org.springframework.cloud.gcp.autoconfigure.security.FirebaseAuthenticationAutoConfiguration.firebaseJwtDelegatingValidator(FirebaseAuthenticationAutoConfiguration.java:67) ~[spring-cloud-gcp-autoconfigure-1.2.2.RELEASE.jar:1.2.2.RELEASE]
      at org.springframework.cloud.gcp.autoconfigure.security.FirebaseAuthenticationAutoConfiguration$$EnhancerBySpringCGLIB$$7b5b39cb.CGLIB$firebaseJwtDelegatingValidator$0(&lt;generated&gt;) ~[spring-cloud-gcp-autoconfigure-1.2.2.RELEASE.jar:1.2.2.RELEASE]
      at org.springframework.cloud.gcp.autoconfigure.security.FirebaseAuthenticationAutoConfiguration$$EnhancerBySpringCGLIB$$7b5b39cb$$FastClassBySpringCGLIB$$6a3e17eb.invoke(&lt;generated&gt;) ~[spring-cloud-gcp-autoconfigure-1.2.2.RELEASE.jar:1.2.2.RELEASE]
      at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.2.5.RELEASE.jar:5.2.5.RELEASE]
      at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-5.2.5.RELEASE.jar:5.2.5.RELEASE]
      at org.springframework.cloud.gcp.autoconfigure.security.FirebaseAuthenticationAutoConfiguration$$EnhancerBySpringCGLIB$$7b5b39cb.firebaseJwtDelegatingValidator(&lt;generated&gt;) ~[spring-cloud-gcp-autoconfigure-1.2.2.RELEASE.jar:1.2.2.RELEASE]
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
      at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
      ... 20 common frames omitted
  Caused by: java.lang.ClassNotFoundException: org.springframework.cloud.gcp.security.firebase.FirebaseTokenValidator
      at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) ~[na:na]
      at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
      at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]
      ... 31 common frames omitted
  </code></pre>
  
  <p>This is my <code>applcation.properties</code></p>
  
  <pre><code>spring.security.oauth2.client.registration.google.client-id = *clientId*
  spring.security.oauth2.client.registration.google.client-secret= = *secret*
  
  spring.cloud.gcp.firestore.project-id=s *projectid*
  spring.cloud.gcp.firestore.enabled=true
  
  spring.cloud.gcp.credentials.location=classpath:credentials.json
  
  spring.main.allow-bean-definition-overriding=true
  </code></pre>
  
  <p>Here is how I am trying to use it in my Service</p>
  
  <pre><code>@Service
  class UserService(): UserDetailsService {
  
      @Autowired
      private lateinit var firestore: Firestore
  
      @Throws(Exception::class)
      fun getUserFromEmail(email:String): User?{
          val future: ApiFuture&lt;DocumentSnapshot&gt; = firestore.collection(User.USERS_PATH).document(email).get()
          val document = future.get()
          if(document.exists()){
              return document.toObject(User::class.java)
          }
  
          return null
      }
  
      @Throws(Exception::class)
      fun createUser(user: User){
          val future: ApiFuture&lt;WriteResult&gt; = firestore.collection(User.USERS_PATH).document(user.email).set(user)
          future.get().updateTime
      }
  }
  </code></pre>
  
  <p>This is probably another configuration issue not mentioned but I cannot figure out what I actually need to do here. Can anyone help me out with this error?</p>