Managing configuration properties for multiple environments

An enterprise level solution always have different environments for different stakeholders like local, dev for developers, UAT/SIT for QAs etc. Then we have a production environment.

Every environment may have different characteristics,  like different email SMTP servers or different database etc. Hybris based projects are no different and have multiple multiple environment based on lifecycle of project.

Now the problem is how to manage configuration for multiple environments. Of course, we can do it manually, where we can have different property files set up on individual server. But this solution is  not modular and efficient.

The approach i am going to present is based on using apache ant to create environment specific file. It will copy properties from one common file and one environment specific file and merge them to create a complete file.

Follow below steps:

  1. Create below  folder structure inside hybris config directory. 


 2. Place your properties in each one of local files as per environment related values. The property which have same values across environment will go to common local property file.

3. Create a build.xml file inside config project and copy below content. 


4. Now we have a ant build xml, which will create a environment specific property file. You can run like below, pass the environment name as required. 


Now you have a flexible solution to configure your hybris system more efficiently, thanks to open source apache ant.


What are different kind of property files in Hybris.

Hybris provides a flexible way to manage properties for your project. You can configure as many as properties as you want in your project.

  • project. properties : This is actually a extension level property file. The properties defined here are available only for the extension, it belongs to. You should define the properties,  which are to be used only in this extension. Hybris provides a property file for each extension by default. The value for a given property is based on the experience and convenience. For example, the URL for HAC.
  • : We have another file called This is available per tenant for the overall application. This file is used to define modify the values given in extension specific file. So it will basically overrides the file value. For example, we can give, database connectivity parameters in this file.
  • We should always use file to customize the behavior of hybris. As any migration or upgrade will not effect, the values to go to default ones.
  • We also have localization property files, to manage the internationalization of project.
  • We need to restart the server to make an effect of change in any property value. Build is not necessary.
  • We can use the properties even in spring managed beans. We can pass them as a property of a bean.
<bean class="StockService">
  <property name="defaultStocklevel" value="${default.stock.level}"/>