users@jersey.java.net

[Jersey] Use Guice to inject something into an XmlAdapter

From: Alexander Zapi <azap01_at_gmx.net>
Date: Sat, 09 Jul 2011 12:51:45 +0200

Hi!

I have implemented an XmlAdapter and I would like that Guice injects something (e.g. an EntityManager) when Jersey instantiates this XmlAdapter. Is this possible? How to do this?

I want my adapter to look like this:

public class CustomerAdapter extends XmlAdapter<Long, Customer> {

  @Inject
  public CustomerAdapter(Something s) {
  {
    // do something with s
  }
}


I want Jersey/Guice to inject an instance of Something. When I try out this code, I get a runtime exception that a no-args constructor for CustomerAdapter is missing.


Perhaps somebody can help me, thank you!
Alex
-- 
NEU: FreePhone - kostenlos mobil telefonieren!			
Jetzt informieren: http://www.gmx.net/de/go/freephone