title: Spring ReactiveMongoRepository bean not generated
body: <p>I am quite new to Java &amp; Spring and this is my first Kotlin app so my problem could be Layer-8 (me). But I really do not know what I make wrong. According to this tutorial (<a href="https://www.baeldung.com/kotlin-mongodb-spring-webflux" rel="nofollow noreferrer">https://www.baeldung.com/kotlin-mongodb-spring-webflux</a>) this should work.</p>
  
  <p>My general app setup is Controller --> Service --> Repository (I did not add the controller since this is not the issue). My problem is that the Repository Bean can not be created by the factory.</p>
  
  <pre><code>org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'driveController' defined in file [/Users/sburger/Documents/Dev/Gravity/App Framework/bouncr/build/classes/kotlin/main/de/example/drive/controller/DriveController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'driveService' defined in file [/Users/sburger/Documents/Dev/Gravity/App Framework/bouncr/build/classes/kotlin/main/de/example/drive/service/DriveService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'IBookingsRepository': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: kotlin/reflect/full/KClasses
      at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:769) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
      at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:218) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1325) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1171) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:849) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
      at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:67) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) ~[spring-boot-2.1.3.RELEASE.jar:2.1.3.RELEASE]
      at de.example.AppKt.main(App.kt:14) ~[main/:na]
      at de.example.AppKt.main(App.kt) ~[main/:na]
  </code></pre>
  
  <p><strong>App.kt</strong></p>
  
  <pre><code>@SpringBootApplication(exclude = [MongoReactiveDataAutoConfiguration::class])
  open class App
  
  fun main() {
      runApplication&lt;App&gt;()
  }
  </code></pre>
  
  <p><strong>MongoConfig.kt</strong></p>
  
  <pre><code>@Configuration
  @EnableReactiveMongoRepositories(basePackageClasses = [IBookingsRepository::class])
  open class MongoConfig : AbstractReactiveMongoConfiguration() {
      override fun getDatabaseName() = "exampledb"
  
      override fun reactiveMongoClient() = mongoClient()
  
      @Bean
      override fun reactiveMongoTemplate() = ReactiveMongoTemplate(mongoClient(), databaseName)
  
      @Bean
      open fun mongoClient(): MongoClient = MongoClients.create()
  
  }
  </code></pre>
  
  <p>I had to mark the class and fun as "open". Without it the build did not work. This is already different to the tutorial. </p>
  
  <p><strong>DriveService.kt</strong></p>
  
  <pre><code>interface IDriveService {
      fun getBookings(userId: String) : Flux&lt;Booking&gt;
  }
  
  @Service
  class DriveService @Autowired constructor(private val bookingsRepository: IBookingsRepository) :
      IBookingService {
      override fun getBookings(userId: String): Flux&lt;Booking&gt; {
         return bookingsRepository.findAll()
      }
  }
  </code></pre>
  
  <p>The "findAll()" method is inherited from ReactiveMongoRepository</p>
  
  <p><strong>BookingsRepository.kt</strong></p>
  
  <pre><code>interface IBookingsRepository : ReactiveMongoRepository&lt;Booking, String&gt;
  </code></pre>
  
  <p>This interface has obviously no init function, but in the tutorial it also has none. So I assume it should work as it is?</p>
  
  <p>Has someone a hint what could be wrong with this setup?</p>