]
Jozef Hartinger commented on AS7-1373:
--------------------------------------
Testcase
Setting EJB's InjectionTarget does not work
-------------------------------------------
Key: AS7-1373
URL:
https://issues.jboss.org/browse/AS7-1373
Project: Application Server 7
Issue Type: Bug
Components: CDI / Weld
Affects Versions: 7.0.0.Final
Reporter: Jozef Hartinger
Assignee: Stuart Douglas
Priority: Blocker
Fix For: 7.0.1.Final
Having an EJB
{code}
@Singleton
public class Bus {
private boolean initialized = false;
public boolean isInitialized() {
return initialized;
}
public void setInitialized(boolean initialized) {
this.initialized = initialized;
}
}
{code}
and a CDI extension that wraps EJB's InjectionTarget
{code}
public class WrappingExtension implements Extension {
public void wrapInjectionTarget(@Observes ProcessInjectionTarget<Bus> event)
{
final InjectionTarget<Bus> injectionTarget = event.getInjectionTarget();
event.setInjectionTarget(new ForwardingInjectionTarget<Bus>() {
@Override
public void inject(Bus instance, CreationalContext<Bus> ctx) {
super.inject(instance, ctx);
instance.setInitialized(true);
}
@Override
public InjectionTarget<Bus> getDelegate() {
return injectionTarget;
}
});
}
}
{code}
the InjectionTarget implementation is never invoked. When the Bus bean is changed to a
CDI bean (@Singleton annotation is removed), the InjectionTarget implementation is invoked
as expected.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: