I’m getting tired of all this boring boilerplate code to parse application configuration like database connections, working directories, API endpoints and whatnot. Spring IoC looks nice, but this will force the user of my application to modify the XML file just to edit the database URL and so on. This might also be very distributed in the XML file where all my other wiring ocours.
What is the best technique to allow end-users to configurate services (which do not run inside an application server)? What go you guys use?
Use Spring, being explicit wiring in XML, auto-wiring or some combination thereof, to define “constant” config and then externalize the rest in properties files. Database credentials are a common example of this.
See Spring and Ibatis Tutorial for a baseline example of this. Short version:
with database.properties (in the classpath):