How to load property file values dynamically in apache camel + spring

Viewed 755

I am a newbie using camel 2.17 with spring. I have a processor which receives an error code from a web service and I configured the error description in the property file like

  myproject.errorCode=1001:error1 description, 1002:error2 description, 1003:....

Currently I am reading the value myproject.errorCode using property injection and parsing all the errorCode with description which is working fine. But the error code list is very huge and maintaining it in a single property is very difficult. So I want to split the properties like

   myproject.errorCode.1001=error1 description
   myproject.errorCode.1002=error2 description
   myproject.errorCode.1003=error3 description
   .....

and I want to read the property in my processor class according to the error code received from the web service like

  String errorCodeRecieved  = myWebService.getErrorCode();
  String errorString = "myproject.errorCode.";
  String errorDescription = something.getProperty(errorString + errorCodeRecieved);

How can I achieve this facility. Thanks in advance

1 Answers
Related