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"/>
等等。
我该怎么做?
谢谢