PersistenceManagerFactory
而不是像这样在我的应用程序中实例化 a :
Properties properties = new Properties();
properties.setProperty("javax.jdo.PersistenceManagerFactoryClass",
"org.datanucleus.jdo.JDOPersistenceManagerFactory");
properties.setProperty("javax.jdo.option.ConnectionDriverName","com.mysql.jdbc.Driver");
properties.setProperty("javax.jdo.option.ConnectionURL","jdbc:mysql://localhost/myDB");
properties.setProperty("javax.jdo.option.ConnectionUserName","login");
properties.setProperty("javax.jdo.option.ConnectionPassword","password");
PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(properties);
我想在 Spring 中为依赖注入配置它,如下所示:
<bean id="persistenceManagerFactory" class="org.springframework.orm.jdo.LocalPersistenceManagerFactoryBean" lazy-init="true">
<property name="persistenceManagerFactoryName" value="transactions-optional" />
</bean>
但我不确定如何传入Properties
(application-context.xml
不使用 a jdoconfig.xml
)。
是否可以application-context.xml
将所有这些Properties
值传递给自动装配?