<bean id= "Placeholderconfig" class= "Com.shz.utils.AdvancedPlaceholderConfigurer" >
<property name= "Locations" >
<list>
<value>classpath:init.properties</value>
<value>classpath:api.properties</value>
</list>
</property>
</bean>
<bean id= "systemproperties" class= "Java.util.HashMap"/>
public class Advancedplaceholderconfigurer extends propertyplaceholderconfigurer{
@SuppressWarnings ({"Unchecked", "Rawtypes"})
@Override
protected void Processproperties (
Configurablelistablebeanfactory beanfactorytoprocess,
Properties props) throws Beansexception {
Super.processproperties (beanfactorytoprocess, props);
/******** Set the properties to InitProperties object ********/
hashmap<string, string> systemproperties = (hashmap<string, string>) Beanfactorytoprocess.getbean (" Systemproperties ");
Logger.info ("Starting to load Configs into Systemproperties object ...");
Enumeration E = Props.propertynames ();
while (E.hasmoreelements ()) {
String key = (string) e.nextelement ();
Systemproperties.put (Key, Props.getproperty (key));
}
Logger.info ("Finished to load Configs into Systemproperties object");
}
}
Public String openagent (Agentinfoparams forexagentinfoparams) {
init ();
try {
ApplicationContext context = Mycontextloaderlistener.getapplicationcontext ();
map<string, string> systemproperties = (map< String, string>) Context.getbean ("Systemproperties");
string to = Systemproperties.get ("Constantnz.forex_cs_ Agent ");
} catch (Exception e) {
logger.error ("error", e);
return "ERROR:" + e.getmessage ();
}
return "OK";
}
Packaging for configuration files in Web Apps