how to embed weld into jetty 9 to have cdi in my j

2019-07-21 07:51发布

问题:

I have a JEE7 project using CDI. I want to test that project on Jetty 9, which implements Java EE 7 Web Profile.

The following link indicate that we can plug Weld into Jetty, but how ? Thanks

EDIT: And, how do that with jetty-maven-plugin ?

Jetty and Java EE 7 Web Profile

回答1:

I tried many things but this is what worked.

http://docs.jboss.org/weld/reference/latest/en-US/html/environments.html#_embedded_jetty

Just be sure to include the appropriate libraries like weld-servlet, cdi-api, el-api and el-impl



回答2:

I wrote some docs on this a while back, if you an issues let me know.

http://www.eclipse.org/jetty/documentation/current/framework-weld.html