Spring Boot 2 Hibernate Search

yod*_*mad 1 spring hibernate hibernate-search spring-boot

我正在尝试将我的应用程序迁移到使用Hibernate Search的Spring Boot 2.我在启动应用时遇到错误:

  • 使用5.5.x.Final:java.lang.NoSuchFieldError: session
  • 使用5.6.x.Final5.8.x.Final:java.lang.ClassNotFoundException: org.hibernate.search.jpa.Search
  • 使用5.7.x.Final5.9.x.Final:An SPI class of type org.apache.lucene.codecs.Codec with name 'Lucene53' does not exist
  • 使用5.10.x.Final:NoClassDefFoundError: org/hibernate/resource/beans/spi/ManagedBeanRegistry

有关信息,目前Spring Boot 2.0.3.RELEASE版本使用Hibernate核心依赖5.2.4.Final

任何想法,使用哪个版本?

Guillaume回答并彻底清理工作区和索引后更新

使用5.9版本,异常已演变为 No transactional EntityManager available

最后一句话

最后一个错误是通过添加@Transactional方法来修复的,但它在没有的情况下在Spring Boot 1中工作.奇怪的...

Gui*_*met 5

您应该使用的版本取决于使用的ORM版本.检查你的依赖.

请参阅此兼容性矩阵:http://hibernate.org/search/releases/#compatibility-matrix

如果您使用的是Spring Boot 2.0.3的默认依赖项,则ORM的版本应该是5.2.17.Final,因此您应该使用Search 5.9.

您还需要使用Lucene 5.5.x,因此如果您来自旧的Lucene版本,则可能需要升级Lucene.