2
我正在使用spring 3.2。我有不同的屬性文件,如a.properties, b.properties, c.properties
。現在在我的春天,我正在使用類似如何使用spring加載基於java參數的動態屬性文件
public class FtpInbound {
private static final String XML_CONFIG_FILE_LOCATION = "springIntegration/ftp-inbound-context.xml";
public static void main(String[] args) {
GenericXmlApplicationContext context = new GenericXmlApplicationContext();
context.load(XML_CONFIG_FILE_LOCATION);
context.refresh();
} //end of main()
} //end of class Main
在XML中,我使用類似
<context:property-placeholder location="/spring/ftp/ftp.properties"/>
<context:component-scan base-package="pk.training.basitMahmood.springIntegration.ftp"/>
現在我想,如果用戶通過一個作爲參數傳遞給main()方法,然後它會成爲
<context:property-placeholder location="/spring/ftp/a.properties"/>
如果用戶通過b鍵main()的參數,則它會變得
<context:property-placeholder location="/spring/ftp/b.properties"/>
等等。
我該怎麼做?
謝謝