[ 
https://issues.apache.org/jira/browse/CXF-5576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13944484#comment-13944484
 ] 

Andriy Redko commented on CXF-5576:
-----------------------------------

Hi guys,

Have a small, but I think quite interesting breakthrough. CXFCdiServlet now is, 
in general, as simple as that (Chiristian's idea):
{noformat}
public class CXFCdiServlet extends CXFNonSpringServlet {
   @Override @Inject
    public void setBus(final Bus bus) {
        super.setBus(bus);
    }
}
{noformat} 

Note of caution: the support is container-specific BUT it works. I still have 
the old detection mechanism in place so pure programmatic, non-webapp based 
deployments are possible. The way it works is container-specific decorators (at 
least in case of Jetty, I am pretty sure Tomcat has a similar concept). So the 
instantiation is done outside the CDI container but then the servlet instance 
is decorated with required dependencies. Works nice but requires a small trick 
for Jetty (see please AbstractJettyServer, it's one liner).

Other than that, I thought a lot about the configuration and extensibility. The 
solution I came up with basically narrows down to two possible scenarios:
 - zero-based configuration effort: this is the current implementation.
 - full-fledged customization: in this case we should provide a minimum, 
Servlet + Bus instance and allow the users to define and inject own 
JAXRSServerFactoryBeans (I am working on test cases and example of that).

Do you think guys it has sense?
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
>         Attachments: weld-one-jar.zip, weld-one-war.zip
>
>
> 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.2#6252)

Reply via email to