users@jersey.java.net

_at_Inject Annotation can inject to Java Interfact type variable?

From: kota <kota0919wasabi_at_gmail.com>
Date: Sat, 4 Sep 2010 19:57:05 -0700 (PDT)

Jersey 1.1.5.1

Hi,everybody

I have a trouble with @Inject(com.sun.jersey.spi.inject.Inject) Annotation.
(I use Jersey 1.1.5.1)

Acctually, I can inject the instance of GreetingImpl class to "greeting" by
using @Inject like this.

        @Inject
        private GreetingImpl greeting;

but I can't inject like below and gets error messages "unable to create
instance "

     @Inject
     private Greeting greeting;

@Inject Annotation can inject the instance for Java Interface type variable?

if can do, how inject? any hint please.

public interface Greeting {

        public String sayHello();
}

public class GreetingImpl implements Greeting {

        public String sayHello() {
                return "Hello,Jersey!";
        }
}
-- 
View this message in context: http://jersey.576304.n2.nabble.com/Inject-Annotation-can-inject-to-Java-Interfact-type-variable-tp5499697p5499697.html
Sent from the Jersey mailing list archive at Nabble.com.