是否可以重用 context-属性 占位符作为需要 <props> 列表的属性的供应商?

Is it possible to reuse context-property placeholder as a supplier for an attribute that expects a <props> list?

我正在通过

定义我的文本属性
<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="...

可能吗?

是的,您可以像这样使用 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"/>