spring.datasource.initialization-mode 的可能值是什么? [英] What are the possible values of spring.datasource.initialization-mode?

查看:90
本文介绍了spring.datasource.initialization-mode 的可能值是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Spring JPA 中配置一个数据库,我想知道 spring.datasource.initialization-mode 的可能值是什么.我找到了 这个页面common 属性,但它没有给出所有可能的值.我希望有一些关于您可以设置的所有属性的所有可能值的文档.

I am configuring a database in Spring JPA and I want to know what the possible values are of spring.datasource.initialization-mode. I found this page with common properties but it doesn't give all possible values. I'd expect there to be some documentation on all possible values of all properties you can set.

我将 applicationContext.xml 中 props 部分中的属性用作 entityManagerFactory

I am using the property in the props section in my applicationContext.xml as properties for the entityManagerFactory

<util:properties id="props">
    <prop key="hibernate.show_sql">true</prop>
    <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQL82Dialect</prop>
    <prop key="hibernate.hbm2ddl.auto">create</prop>
    <prop key="hibernate.ddl-auto">create</prop>
    <prop key="spring.jpa.show-sql">true</prop>
    <prop key="spring.jpa.generate.ddl">true</prop>
    <prop key="spring.jpa.hibernate.ddl-auto">create</prop>
    <prop key="spring.datasource.initialization-mode">always</prop>
    <prop key="spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation">true</prop>
</util:properties>

推荐答案

当所有其他方法都失败时,请记住使用源代码,Luke!".这些值在 Javadoc 中给出 枚举 DataSourceInitializationMode.值为 alwaysembeddednever.

When all else fails, you remember "use the source, Luke!". The values are given in the Javadoc of the enum DataSourceInitializationMode. Values are always, embedded and never.

这篇关于spring.datasource.initialization-mode 的可能值是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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