开发者

Using an EJB inside a JAX-RS resource class in RestEasy?

I would like to have the following kind of resource class work when deployed under RestEasy in JBoss 6:

@Path("Something")
public class Foo {

  @EJB
  private SomeService service

  @GET
  public Object frobnicate() {
    assert service != null;
    // JBoss blows up here

    return result;
  }
}

Two questions:

  1. It is a limitation of RestEasy, not of the Java EE specification, right, that RestEasy can't inject anything annotated with @EJB?
  2. What have people done to work around this limitation?

My developers are ab开发者_开发技巧out to surge forward with hard-coded JNDI lookups (e.g. context.lookup(someHardCodedNameHere)) because no one can find a workaround to this specification violation at the present time. I really want to avoid this.

Lastly, I've looked at using CDI, but the story here isn't much better as RestEasy and CDI still aren't talking to each other.

Thanks in advance for any pointers.


The JBoss guys tell me this is being worked on on the trunk. So as of JBoss 6 milestone 3 this is impossible.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜