Women in Technology

Hear us Roar



Article:
  Twelve Best Practices For Spring XML Configurations
Subject:   Separate environment specific properties
Date:   2006-01-26 01:54:29
From:   Frank_Mölder
I would like to add that separating environment (dev, test, accept, production) specific properties like urls, usernames, passwords, etc in a property file instead of the spring config file improves maintainability a lot.


By using the PropertyPlaceholderConfigurer the spring config file remains generic for all environments and the build process takes care of putting the correct propertyfile on the classpath.


I use the mechanism to inject a mock implementation of a DAO for the development environment and for the other environments the "real thing". Just be changing the value of a key in the property file.