4 Replies Latest reply: Apr 10, 2012 6:04 AM by Supriya Shyamal RSS

CDI producer bean with jax-rs dependency

Supriya Shyamal Newbie

I have treid a example with weld as CDI container with jersey as jax-rs implementation for the dependency of jax-rs resources on CDI producer bean. Below is my CDI producer class which priduces unique id depends on session id or user provided id through REST path ..


public class UuidProducer {



    private Logger log;



    private HttpServletRequest request;



    private String uuid;





    public String produceUuid() {

        if (StringUtils.isNotBlank(uuid)) {

            return uuid;


        if (request.getSession() != null) {

            return request.getSession().getId();


        log.info("Generating UUID...");

        return UUID.randomUUID().toString();






When I tried this with Jboss AS7 with RestEasy implementation no jax-rs resource is injected into this CDI class. My question is that if how can I inject jax-rs resource in normal CDI bean?