我对 Helidon 2.0.1 有疑问
当我尝试使用 ConfigFile 使用外部文件 /etc/config/application.yaml 时,JPA 不起作用。它的端口配置(serve.port:8001)。
好消息是当我使用内部配置文件时,它运行良好,使用“src/main/resources/application.yaml”
我的自定义启动服务器:
static Server startServer() {
return Server.builder()
.config(buildConfig())
.build()
.start();
}
public static Config buildConfig() {
return Config.builder().sources(
ConfigSources.file("/etc/conf/application.yaml")
).build();
}
我的persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.2"
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_2.xsd">
<persistence-unit name="ZettaPU"
transaction-type="JTA">
<description>A persistence unit for the Zetta.</description>
<jta-data-source>ZettaDS</jta-data-source>
<class>com.zetta.entities.Catalogo</class>
<properties>
<property name="eclipselink.deploy-on-startup" value="true" />
<property name="eclipselink.jdbc.native-sql" value="true" />
<property name="eclipselink.logging.logger" value="JavaLogger" />
<property name="eclipselink.logging.parameters" value="true" />
<property name="eclipselink.target-database" value="org.eclipse.persistence.platform.database.SQLServerPlatform" />
<property name="eclipselink.target-server" value="io.helidon.integrations.cdi.eclipselink.CDISEPlatform" />
<property name="eclipselink.weaving" value="false" />
</properties>
</persistence-unit>
</persistence>
我的应用程序.yaml
server:
port: 8001
host: 0.0.0.0
javax:
sql:
DataSource:
distribuidoresDS:
dataSourceClassName: com.microsoft.sqlserver.jdbc.SQLServerDataSource
dataSource:
url: jdbc:sqlserver://localhost:1433;databaseName=ZettaDB;
user: zettaDB
password: ********
非常感谢