Spring Boot,休眠搜索属性 [英] Spring Boot, Hibernate Search properties

查看:94
本文介绍了Spring Boot,休眠搜索属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Spring Boot时如何提供Hibernate Search参数?

How to provide Hibernate Search parameters when using Spring Boot?

...
spring.datasource.driverClassName=org.postgresql.Driver

hibernate.search.jmx_enabled=true
hibernate.search.default.directory_provider=filesystem
hibernate.search.generate_statistics=true
hibernate.search.lucene_version=LUCENE_CURRENT
hibernate.search.default.indexBase=/mypath-to-index

它不在乎我提供什么.始终会应用默认设置.

It does not care what I provide. Default settings always get applied.

我认为下面的代码没有任何东西可以处理与Hibernate Search相关的属性.这可以成为问题吗?

I think below code does not have anything to process properties related to Hibernate Search. Can that be the issue?

推荐答案

如果放置"spring.jpa.properties",则可以将它们放置在application.properties文件中.在属性名称之前.

You can put them in the application.properties file if you put "spring.jpa.properties." in front of the property names.

示例:

spring.jpa.properties.hibernate.search.jmx_enabled=true
spring.jpa.properties.hibernate.search.default.directory_provider=filesystem
spring.jpa.properties.hibernate.search.generate_statistics=true
spring.jpa.properties.hibernate.search.lucene_version=LUCENE_CURRENT
spring.jpa.properties.hibernate.search.default.indexBase=/mypath-to-index

Spring将在spring.jpa.properties.*下获取任何属性,并在创建EntityManagerFactory后将它们传递(带有前缀).

Spring will take any properties under spring.jpa.properties.* and pass them along (with the prefix stripped) once the EntityManagerFactory is created.

这篇关于Spring Boot,休眠搜索属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆