我需要在加载上下文时加载属性文件。(constants.properties如下例所示)此属性文件中的一个键指向另一个不在类路径中的属性文件(例如privatedata.properties) 。我需要读取privatedata.properties文件的属性并注入我的bean。我可以在Spring 3.x中借助@Configuration注释在下面执行此操作。我如何在Spring2.5.1中获得相同的功能?
使用Spring 3.x
package com.snippets.enterprise;
**@Configuration**
@PropertySource("classpath:/constants.properties")
public class SpringConfig { }
<context:component-scan base-package="com.snippets.enterprise"/>
//constants.properties has a key called private.supportiveFile and that points to the
file in **non-class path**
<context:property-placeholder location="file:${private.supportiveFile}" />
<bean id="helloWorldBean"
class="com.snippets.enterprise.services.HelloWorld">
<property name="key" value="${keypath}" />
</bean>
How can I get the same capability in Spring2.5.X.
org.springframework.context.annotation.Configuration is present from spring3.x onwards.