Java 是否可以将上下文属性占位符重新用作预期为<;道具>;列表
我通过以下方式定义我的文本属性:Java 是否可以将上下文属性占位符重新用作预期为<;道具>;列表,java,spring,spring-data,spring-data-jpa,Java,Spring,Spring Data,Spring Data Jpa,我通过以下方式定义我的文本属性: <context:property-placeholder location="application.properties"/> 然后,我得到了类似 <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" p:jpaProperties-ref="*****"/> 我喜
<context:property-placeholder location="application.properties"/>
然后,我得到了类似
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" p:jpaProperties-ref="*****"/>
我喜欢提供对上下文属性占位符的引用,而不是使用
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="...
${hibernate.dial}
是的,您可以像这样使用PropertiesFactoryBean:
<bean id="jpaProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="location" value="classpath:/jpa.properties"/>
</bean>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" p:jpaProperties-ref="japProperties"/>
是的,您可以像这样使用PropertiesFactoryBean:
<bean id="jpaProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="location" value="classpath:/jpa.properties"/>
</bean>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" p:jpaProperties-ref="japProperties"/>
如果文件中有非相关属性,是否有问题?根本没有问题,您可以使用应用程序。属性如果文件中有非相关属性,是否有问题?根本没有问题,您可以使用应用程序。属性