JNDI string bindings vs external properties files

It’s pretty common to have a web application depending on server side properties. An obvious example is when you want the app to connect to a database connection depending on whether the app is on a development server or a production server.

I’ve worked on apps that store those properties in external properties files (accessed via the classpath) as well as apps that store the values in string-based JNDI bindings.

My question is which approach is better. On the one hand, the properties file lets me feel like I’m developing an app that’s very independent of the server technology. Also, it feels abusive to use the sophisticated JNDI technology to get a simple string.

But the thing I really like about JNDI is that the application can fail fast on deployment if the binding hasn’t been configured.

Leave a Reply

Your email address will not be published. Required fields are marked *