Reading Time: 8 minutes

It is always recommended to use Spring properties with , to externalize any configuration parameters (URLs, ports, user names, passwords, etc.). For example, the Acme API from my previous post connects to an external database. So instead of hard-coding connectivity options inside my application code, I would create a properties file, e.g., as follows:

Obviously, as a developer, I would use a test instance of Acme database to test my application. I'd commit the code to the version control system, including the properties file. Then my application would begin its journey from the automated build system to the Dev environment, to QA, Pre-Prod, and finally Prod – and fail to deploy on production because it wouldn't be able to connect to the test database! Or even worse, it would connect to the test database and use it and no one would notice the problem until customers placed $0 order for an Acme widget which would normally cost $1000, all because the test database didn't contain actual prices!

Sure, I could just follow the recommendations on our web site and create multiple sets of properties, e.g.,, etc. But instead of solving the problem, it would create a few new ones.

  • First, those properties must still be packaged within the application. Needless to say, IT guys would never give me the credentials for the production database, so I'd have to provide instructions for them on how to modify the properties file AFTER the application is deployed on the prod platform.
  • Second, if (or rather WHEN) any of those properties will need to be changed (for example, the production DB is migrated to a new server), the whole process has to be repeated. And don't forget about passwords and other sensitive that should never appear in the code as open text and have to be encrypted.
latest report
Learn why we are the Leaders in API management and iPaaS

It seems like every single customer I've worked with has this problem. And there was no convincing solution until one of our customers told me about an application called Zuul.

As the description on the Zuul web site says, “Zuul is a free, open source web application which can be used to centralize and manage configuration for your internal applications. It enables your operations team to control changes and your developers a centralized place to organize settings.” Of course, I couldn't resist the urge to download it and try it out with Mule.

The installation and configuration of the Zuul server was pretty straightforward. After all, Zuul is a standard web application, so I just deployed it to my local Tomcat instance, alongside with MMC which was already deployed on it. I configured the database settings to point to my local MySQL instance. For the LDAP server I used OpenLDAP. I had to download and install the Unlimited Strength JCE Policy Files. Then I started Tomcat and opened the Zuul URL in my browser and logged in as administrator.

The first task is to create my environments. Navigating to Administration->Environments menu, I see three environments, prod, qa, and dev, which Zuul creates by default. Just what I need! Moreover, the prod environment is red – which means, only someone with Administrator privileges can mess with it.

And while we are in the Administration screen, let's create a new encryption key for our password values. Administration->Key Management, then click on Create New... button and populate the form:

And now we can create our properties. Select Settings->Create New, give it a name, e.g. AcmeProperties. On the next screen, you're given the option to create a new properties set from scratch, or to upload an existing properties file. Since we already have for our dev environment, let's just use it. Select dev environment on the left tab, then click Upload File button:

Upload and you'll see the following screen:

Now we can encrypt the database password. Just make sure the correct key is selected, then click Edit and select Encrypt.

To finish the server setup, we replicate this set of properties on the qa and prod environments. Select qa tab, then click Copy Existing, then in the Search text box type dev. Your properties set "/dev/" will be highlighted. Click Copy button and now you have the identical set of properties in qa. Repeat the process for the prod environment. Change properties values on each environment accordingly.

This concludes the server setup procedure. In the next post, I will show you how to configure Mule to use Zuul properties management.

See part II of this post.