在Spring Boot M7和MongoDB中找不到ReflectKotlinClass

如果使用Web和MongoDB模块在start.spring.io上创建一个新的Spring Boot项目,请添加任何@Document注释类,并且将kotlin.version从1.2.10升级到1.2.21,您将得到一个NoClassDefFoundError:

Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.0.M7:run (default-cli) on project demo: An exception occurred while running. null: InvocationTargetException: Error creating bean with name 'mongoTemplate' defined in class path resource [org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfiguration.class]: Unsatisfied dependency expressed through method 'mongoTemplate' parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mappingMongoConverter' defined in class path resource [org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfiguration.class]: Unsatisfied dependency expressed through method 'mappingMongoConverter' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoMappingContext' defined in class path resource [org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: kotlin/reflect/jvm/internal/impl/load/kotlin/reflect/ReflectKotlinClass: kotlin.reflect.jvm.internal.impl.load.kotlin.reflect.ReflectKotlinClass 

当@Document注释类被删除时,应用程序开始没有问题。

从错误消息看起来像MongoDataAutoConfiguration需要在类路径中找不到的ReflectKotlinClass。 kotlin-reflect模块位于依赖列表中。 是否还有其他kotlin模块需要?

它看起来像是有一个错误报告提交,解决相同的问题: https ://jira.spring.io/browse/DATACMNS-1245与spring-data-commons 2.0.3.RELEASE问题不再发生。