How can I inject a data source dependency into a RESTful web service with Jersey (Test Framework)?
问题 I'm building a RESTful web service using Jersey that relies on MongoDB for persistence. The web service itself connects to the default database, but for the unit tests, I would like to use a separate test database. I would populate this test database in setUp, run my tests, and then destroy it in tearDown. Normally, I would use dependency injection here to supply the data source to an entity manager that the service would use, but in this case the web service is running independent of the