users@glassfish.java.net

How to call _at_Service from plain Java class?

From: Anton Shishkov <anton.shishkov_at_gmail.com>
Date: Mon, 7 Apr 2008 01:04:18 +0300

Hi all,

 

I need to get information about how can I execute @Services from plain Java
classes? Right now I am getting a NullPointerException.

 

Example:

 

import org.jvnet.hk2.annotations.Inject;

 

import sahoo.hello.api.Bar;

 

public class PlainClass {

 

      @Inject

      Bar bar;

 

      public void doit() {

            System.out.println("PlainClass() -> bar do it ");

            bar.doit();

      }

 

}

 

 

Thank you,

 

Anton Shishkov