Open gaosaroma opened 2 weeks ago
解决方式:
在基座打包时,可以通过 maven-resources-plugin 把 conf 资源打包到 jar 包中,如:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<!-- here the phase you need -->
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/classes/conf/ark</outputDirectory>
<resources>
<resource>
<directory>${basedir}/conf/ark</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
Feature description
现状
在 SOFA-ARK 2.0+ 中,基座启动 ArkContainer 时,将通过 ContainerClassLoader 读取自定义配置。但 ContainerClassLoader 的 ucp 仅有基座 resources/conf/ark 目录、 sofa-ark-all 及其依赖,从而无法读取用户自定义配置,见:
Ark 配置读取 com.alipay.sofa.ark.container.ArkContainer#getProfileConfFiles
ContainerClassLoader 初始化 com.alipay.sofa.ark.bootstrap.AbstractLauncher#createContainerClassLoader(com.alipay.sofa.ark.spi.archive.ContainerArchive)
需求
支持读取用户基座中 conf/ark/bootstrap.properties 作为自定义配置。
Additional notes
Add other notes if necessary.