我有一个用于连接数据库的persistence.xml文件,但目前所有属性都在属性标签内部进行了硬编码,我想在可能的情况下将其外化到我的应用程序之外:我的war文件或如果不是那么在属性文件中。 如何做出这样的改变。
我的persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="Test" transaction-type="RESOURCE_LOCAL">
<class>persistencetier.Ap_Interface_Intercompany_Entity</class>
<class>persistencetier.HealthCheckEntity</class>
<class>persistencetier.HealthSummaryEntity</class>
<class>persistencetier.LockBoxEntity</class>
<class>persistencetier.Receivable_Ar_InterfaceEntity</class>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:@Localhost:1521:xe"/>
<property name="javax.persistence.jdbc.user" value="****"/>
<property name="javax.persistence.jdbc.password" value="****"/>
<property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver"/>
</properties>
</persistence-unit>
</persistence>