我正在尝试在 javaee6 中复制 seam 属性文件的加载,但仍然不知道从哪里开始。
在 seam 中,我们可以通过在 components.xml 中定义属性文件来将其加载为 seam 组件:
<component name="propertyBean" class="PropertyBean" scope="application" auto-create="true" startup="true">
<property name="filename">myPropertyFile.properties</property>
<property name="reload">true</property>
</component>
然后我们可以在代码中访问它:
PropertyBean.getInstance().getProperty("myProperty");
是否有可以复制此功能的 javaee6 功能?或者在春天它被称为 PropertyPlaceholder。
在 C# 中,我们可以通过在 appsettings.xml 中添加配置属性来实现。并通过 ConfigurationManager 访问。
谢谢,
czetsuya