Spring Boot, Hibernate Search properties

前端 未结 2 1068
悲&欢浪女
悲&欢浪女 2021-01-03 05:29

How to provide Hibernate Search parameters when using Spring Boot?

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

hibernate.search.jmx_enabled=         


        
相关标签:
2条回答
  • 2021-01-03 05:55

    Got it working.

    Put another property file named "hibernate.properties" inside src/main/resources with below content.

    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
    
    0 讨论(0)
  • 2021-01-03 06:01

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

    Example:

    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 will take any properties under spring.jpa.properties.* and pass them along (with the prefix stripped) once the EntityManagerFactory is created.

    0 讨论(0)
提交回复
热议问题