Im having trouble understanding why I would use a context.xml file to declare a resource, in my case a database connection pool. Hopefully I've got my facts straight in the following arguments against using context.xml
As far as I can tell, resources declared in /META-INF/context.xml are only available within the context, so there's no reason to do so to share resources.
Declaring a connection pool resource in this way creates a dependency on the container's classloader, so if I do so and, for example, wish to change my database drivers, I must restart the container, not just my context.
I also create a dependency on containery things like JNDI, which makes standlone testing tricker.
Finally, I have to jump through build-time hoops to switch resources between test and production resources for example.
None of these issues are insurmountable, but it certainly seems on paper much more straightforward to just create a connection pool and hook it into my context scope.
I'd like to know under what circumstances are context.xml files the right answer?