To inject an instance of class C
:
javax.enterprise.inject.spi.CDI.current().select(C.class).get()
This is available in CDI 1.1+
More Related Contents:
- Why use @PostConstruct?
- CDI: beans.xml, where do I put you?
- Why use constructor over setter injection in CDI?
- How to create a modular JSF 2.0 application?
- Injecting a Spring bean using CDI @Inject
- What is a JavaBean exactly?
- What exactly is Field Injection and how to avoid it?
- How can I inject a property value into a Spring Bean which was configured using annotations?
- @Resource vs @Autowired
- How to inject a Map using the @Value Spring Annotation?
- What is the difference between @Inject and @Autowired in Spring Framework? Which one to use under what condition?
- How to inject an object into jersey request context?
- Spring Autowiring class vs. interface?
- Dependency Injection and JavaFX
- Spring: Why do we autowire the interface and not the implemented class?
- exclude @Component from @ComponentScan
- Should I use @EJB or @Inject
- Field.get(obj) returns all nulls on injected CDI managed beans, while manually invoking getters return correct values
- Inject bean into enum
- How do I properly configure an EntityManager in a jersey / hk2 application?
- Spring injection Into Servlet
- Spring annotation-based DI vs xml configuration?
- Spring Property Injection in a final attribute @Value – Java
- How to create custom annotation with code behind
- Looking for an example for Dagger assisted injection
- How to collect and inject all beans of a given type in Spring XML configuration
- Anyway to @Inject/@Autowire an inner class into an outer class?
- How to implement the “robot legs” use case with Google Guice?
- Spring JUnit: How to Mock autowired component in autowired component
- How to enable CDI inject in web service (jaxrs/jersey) on java se running grizzly?