WebSphere Liberty is an application server offering by IBM. It is fast, dynamic, and easy for configuration. The server is built on the open-source Open Liberty project.
With the growth of WebSphere Liberty over the last few years to support the full Java EE 7 platform, it’s no more a tool confined to be used for quick development but has resulted in an increase in its adoption for final production environment deployment. Many of the solutions have been opting to migrate from ‘traditional’ WebSphere Application Server (WAS) to WebSphere Liberty.
If you are wondering how easy to get started with Liberty, then spend 2 minutes to watch the video:
Recently I have as well migrated my solution to WebSphere Liberty. During this migration, one issue I encountered is how to manage the configuration of data source, JNDI, shared libraries in server.xml so as not to clutter everything in a single long file. And moreover, I was looking for having a better control over the dynamic configuration values like database server details etc.
WebSphere Liberty provides two beautiful features to tackle both of these issues. First is you can use include elements to consolidate the configuration from different files. And second, you can specify the environment variable in the server.env file to customize the environment.
Datasource Configuration in WebSphere Liberty
Let me take an example of data source configuration to show above in action. Let’s create a server_ds_config.xml as below: