I do not understand the needs of the JerseyTest that uses the Spring bean, often your Spring Beans is the Service / Dao level, and they should be Unit test / Integration Test on their layer using Mockito or DBUnit (integration tests).
I participated in testing Jersey resource classes using Sprig Beans as a mockery because you only need to isolate the tests and test the Jersey (and Json) stuff on the JerseyTest and not on the service or Dao Layer. follow my Spring bean context, but Spring Beans are only mocks because I don't want to test Spring Beans in JerseyTests.
If you isolate your tests, it would be easier to write and maintain tests
user1648865
source share