[ https://issues.apache.org/jira/browse/CXF-5576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13917190#comment-13917190 ]
Andriy Redko edited comment on CXF-5576 at 3/1/14 9:22 PM: ----------------------------------------------------------- Hi guys, I finally have the PoC working (for simplest use cases). It's actually involves only two classes: CDI portable extension and a simple servlet derived from CXFNonSpringServlet. Here is the high-level overview how it works: - CDI container starts and detects our portable extension - extension starts to listen for the events from CDI container and automatically detects JAX-RS applications and resources - once CDI container starts, extension instantiates all discovered applications (for now only 1 is supported) and resources At this point, the servlet comes into play: - it tries to detect the presence of CDI container - if CDI container is detected, servlet asks for the instance of the portable extension - once retrieved, servlet asks for discovered application and resources - and uses JAXRSServerFactoryBean to create the server for application and resources (service beans) It looks quite simple and it really is. I have two PoC applications, one uses embedded Jetty and another one is WAR file deployed under Tomcat 8. In both cases, everything works: CDI resources are injected (@Inject) along with JAX-RS specific ones (@Context). Please validate this approach and let me know your opinion. I can provide the samples at first demand (or attach them to this JIRA if you guys see it as a good start). Worth to mention, the PoC is build with Weld 2.x / CDI 1.1. Thanks. Andriy was (Author: reta): Hi guys, I finally have the PoC working (for simplest use cases). It's actually involves only two classes: CDI portable extension and a simple servlet derived from CXFNonSpringServlet. Here is the high-level overview how it works: - CDI container starts and detects our portable extension - extension starts to listen for the events from CDI container and automatically detects JAX-RS applications and resources - once CDI container starts, extension instantiates all discovered applications (for now only 1 is supported) and resources At this point, the servlet comes into play: - it tries to detect the presence of CDI container - if CDI container is detected, servlet asks for the instance of the portable extension - once retrieved, servlet asks for discovered application and resources - and uses JAXRSServerFactoryBean to create the server for application and resources (service beans) It looks quite simple and it really is. I have two PoC applications, one uses embedded Jetty and another one is WAR file deployed under Tomcat 8. In both cases, everything works: CDI resources are injected (@Inject) along with JAX-RS specific ones (@Context). Please validate this approach and let me know your opinion. I can provide the samples at first demand (or attach them to this JIRA if you guys see it as a good start). Thanks. Andriy > Initital support for CDI integration > ------------------------------------ > > Key: CXF-5576 > URL: https://issues.apache.org/jira/browse/CXF-5576 > Project: CXF > Issue Type: Improvement > Components: Core > Affects Versions: 3.0.0 > Reporter: Andriy Redko > Assignee: Andriy Redko > Labels: cdi > > A per section 10.2.3 Context and Dependency Injection (CDI) of JAX-RS 2.0 > specification, in a product that supports CDI, the implementations MUST > support the use of CDI-style Beans as root resource classes, providers and > Application subclasses. Providers and Application subclasses MUST be > singletons or use application scope. -- This message was sent by Atlassian JIRA (v6.1.5#6160)