0

我在 Oracle Weblogic 10.3 中部署了一个应用程序。在我的 .ear 文件中,我使用来自 ear 文件中的 xml 文件的弹簧注入。我还想从放置在服务器文件系统上的 xml 文件执行依赖注入。我们在 Karaf 中做了类似的事情,我们将捆绑包的配置文件放在服务器本身的 conf 目录中。在 weblogic 中是否有类似的方法可以做到这一点?

4

1 回答 1

1

您可以要求spring 从文件系统中读取属性,如下所示;

<!-- Reads application properties and uses them in the application context -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="ignoreResourceNotFound" value="true"/>
    <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
    <property name="locations">
        <list>
            <value>file:D:\somefolder\application.properties</value>
            <value>classpath:com/foo/sp.properties</value>
        </list>
    </property>
</bean>
于 2012-05-03T03:10:04.557 回答