简体   繁体   中英

Injecting EJB3 / CDI / JSF beans in console application for testing / experimentation purposes

Is there any way to inject EJB3 / CDI / JSF beans (if the last category makes any sense) and use the respective annotations without having to use a Java EE container? Ie in a plain old static void main type console application?

Reason might be for experimentation / testing / behavior deciphering purposes.

EJB3, CID and JSF runs over a Java EE container: GlassFish , JBoss , IBM WebSphere Application Server and so on. Note that Tomcat is not a Java EE container, it's a Servlet/JSP container.

A console project, in the other hand, run over Java SE container, this is, a simple JRE installation. If you try to download the Java Platform, Enterprise Edition 6 SDK , you will notice that it's a GlassFish distribution.

If you want/need to do proof of concepts using these technologies, you should create a simple Web project and deploy it on any Java EE containers. IMO I would recommend JBoss AS 7 for being lightweight on deployment (note: people can correct me if I'm wrong).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM