I am migrating an application to Java EE 7 and would like to CDI 1.1. But I don't get the meaning of bean-discovery-mode="annotated"
. The
CDI 1.1 specification is not very helpful. At least I have not found any useful paragraph. Did I miss it?
This example runs perfectly with bean-discovery-mode="all"
and injects an instance of LoggingClass
:
public class LoggingClass {
public Logger logger = Logger.getLogger("ALOGGER");
}
@Test
public class MMLoggerProducerIT extends Arquillian {
@Inject private LoggingClass lc;
}
But if I change from bean-discovery-mode="all"
to bean-discovery-mode="annotated"
the container is not able to inject an instance into the field lc
.
How do I have to annotate LoggingClass
to use bean-discovery-mode="annotated"
correctly?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…