Pergunta

What's the best way to integrate CDI with GWT? In particular, I'd like to know how to make dependency injection work for my RemoteServiceServlet extensions. Apparently CDI won't work with classes derived from javax.servlet.Servlet. I'm happy to ditch RemoteServiceServlet if there is an alternative.

I don't really need DI on the GWT client-side, but would happily use it if it Just Worked.

Foi útil?

Solução

It turns out to be a bug in Weld, which is already fixed in version 1.1.0.

Intellij IDEA X also has this "bug", as it flags it as an error if you try to do this with a RemoteServiceServlet. I just disabled the inspection for that.

Outras dicas

I believe Errai is what you're looking for if you want to integrate CDI with GWT. I haven't used it myself on a real project but it looks really cool. It will even bridge CDI events between the browser and your server and can pretty much replace the existing GWT RPC mechanism.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top