What is the best way for use Dependency Injection in JEE6 / JAX-RS without Jersey? We would use CDI, but we also need it for a embeded server (Jetty or Grizzly). It is for tests.
Asked
Active
Viewed 126 times
0
-
I mean: in JEE5 with Websphere 7 we used Jersey as implementation of JAX-RS. There is DI with [provider possible]( jersey.java.net/documentation/latest/ioc.html ). We also had a [Jersey Test] ( jersey.java.net/documentation/latest/test-framework.html) with Grizzly as In-Memory container for the tests. Here we injected mocks to test resources. It were test for the HTTP-API of the app. We were very satisfied with this – Robert Jan 17 '15 at 13:13
-
Now we have Websphere 8.5 with JEE6 and we want use JAX-RS from Websphere (our admins want this :-( ). IBM uses Apache-Wink as implementation for JAX-RS. Bot we look for alternatives for DI in this container. We want to have this test with embeded container. I hope my explanation is clear for this problem. – Robert Jan 17 '15 at 13:13
-
It's unclear from your question what role DI has to do with this issue. – John Ament Jan 17 '15 at 23:22
-
We use DI for injectincting the mocks in the resorces. – Robert Jan 18 '15 at 10:05
2 Answers
0
DI is not a part of JAX-RS spec. JAX-RS is a spec only and Jersey is an implementation of it. There are other implementations like Apache CXF which play nicer with other DI frameworks (like Spring) or not use any at all.
Does this answer your question? It's not clear what you're trying to do.

Lev Kuznetsov
- 3,520
- 5
- 20
- 33
0
You should be able to continue using Jersey in Websphere 8.5 by disabling the jax-rs engine and using a Isolated Classloader with shared library for jersey library/jars and referring the same in your application.
Another thread with more details on same.