views:

17

answers:

1

i have a producer, i want to put it in a jar, so that my diff war files can refer the same implementation

public class LogFactory {

  @Produces
  public Logger createLogger(InjectionPoint injectionPoint) {
    return Logger.getLogger(injectionPoint.getMember().getDeclaringClass().getName());
  }
}

but it turns now, glassfish (3.0.1) can not auto discover the producer method

how to fix this?

+2  A: 

I'm not 100% sure but is the JAR CDI enabled (i.e. does it have a beans.xml)?

Pascal Thivent
i got it, went back to read the spec, turns out i need to put the beans.xml inside the meta-inf
Dapeng
@Dapeng Yes, that's it.
Pascal Thivent