繁体   English   中英

如何在没有persistence.xml文件的情况下禁用Wildfly 10 Hibernate Search模块,该文件是自动配置的Spring Boot应用程序?

[英]How to disable Wildfly 10 Hibernate Search module without persistence.xml file is autoconfigured Spring Boot app?

嗨,大家好!

我正在使用Hibernate Search 5.5开发Spring Boot 1.5应用程序。 作为独立应用程序,它正在按预期运行,但是在将其部署到Wildfly 10时遇到了问题。在部署过程中,它引发了异常: java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider org.hibernate.search.hcore.impl.HibernateSearchIntegrator not a subtype

我想禁用Wildfly Hibernate Search的实现,并提供与我的应用程序一起预包装的内容。 我发现我必须在persistence.xml文件中提供wildfly.jpa.hibernate.search.module = none属性。 我的问题是如何在不重写整个Spring Boot数据源自动配置的情况下执行此操作?

最后,我找到了强制Wildfly不加载提供的Hibernate Search模块的解决方案。 我已在Wildfly 10文档中的Wildfly中的类加载中阅读了有关提供jboss-deployment-structure.xml文件的信息。 在使用我的应用构建WAR文件期间,我将此文件添加到META-INF目录中,其内容如下:

<?xml version="1.0"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
        <exclusions>
            <module name="org.hibernate.search.orm"/>
        </exclusions>
    </deployment>
</jboss-deployment-structure>

这种配置解决了我的问题,Wildfly正在加载与我的应用打包在一起的Hibernate Search。

尝试将其添加到application.yaml

spring.jpa.properties:
    wildfly.jpa.hibernate.search.module: none

在这里查看带有Hibernate Search的Spring Boot应用程序示例。 但是,它不使用WildFly。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM