Customizing data source URL per environment

In our application, I point json data source to a different server. It can be easily accomplished with setDataURL(..) method. However, I would like the URL to change based on the environment application is deployed to. This would allow me to use the same build for SIT, UAT, PROD.
How can I customize this URL using external property - ideally read from properties file in classpath. Reading from environment property or web.xml is acceptable as well.

Thanks for help.

Hard to believe that there is nobody that dealt with it in the past.