[
https://jira.jboss.org/jira/browse/WELD-313?page=com.atlassian.jira.plugi...
]
Pete Muir updated WELD-313:
---------------------------
Description:
ManagedBean.create() looks like this:
public T create(CreationalContext<T> creationalContext)
{
T instance = getInjectionTarget().produce(creationalContext);
getInjectionTarget().inject(instance, creationalContext);
if (isInterceptionCandidate() && (hasCdiBoundInterceptors() ||
hasDirectlyDefinedInterceptors()))
{
InterceptionUtils.executePostConstruct(instance);
}
else
{
getInjectionTarget().postConstruct(instance);
}
return instance;
}
The code that is aware of interceptors needs to be sucked into
InjectionTarget.postConstruct(), since a portable extension can't easily reproduce
that logic. create() should look like:
public T create(CreationalContext<T> creationalContext)
{
T instance = getInjectionTarget().produce(creationalContext);
getInjectionTarget().inject(instance, creationalContext);
getInjectionTarget().postConstruct(instance);
return instance;
}
Same goes for destroy().
was:
ManagedBean.create() looks like this:
public T create(CreationalContext<T> creationalContext)
{
T instance = getInjectionTarget().produce(creationalContext);
getInjectionTarget().inject(instance, creationalContext);
if (isInterceptionCandidate() && (hasCdiBoundInterceptors() ||
hasDirectlyDefinedInterceptors()))
{
InterceptionUtils.executePostConstruct(instance);
}
else
{
getInjectionTarget().postConstruct(instance);
}
return instance;
}
The code that is aware of interceptors needs to be sucked into
InjectionTarget.postConstruct(), since a portable extension can't easily reproduce
that logic. create() should look like:
public T create(CreationalContext<T> creationalContext)
{
T instance = getInjectionTarget().produce(creationalContext);
getInjectionTarget().inject(instance, creationalContext);
getInjectionTarget().postConstruct(instance);
return instance;
}
Same goes for destroy().
The implementations of create() and destroy() in SessionBean are even worse. In this case,
InjectionTarget.produce() seems to be doing something completely wrong and broken. It is
supposed to return a non-container-managed object. EJB should be the thing calling it, not
Weld directly.
Moved SessionBean issue to WELD-329
create() method of container Bean implementations should be
reproducible with user Bean implementations
-------------------------------------------------------------------------------------------------------
Key: WELD-313
URL:
https://jira.jboss.org/jira/browse/WELD-313
Project: Weld
Issue Type: Bug
Components: Class Beans (Managed and Session)
Affects Versions: 1.0.0.GA
Reporter: Gavin King
Priority: Critical
Fix For: 1.0.1.CR1
ManagedBean.create() looks like this:
public T create(CreationalContext<T> creationalContext)
{
T instance = getInjectionTarget().produce(creationalContext);
getInjectionTarget().inject(instance, creationalContext);
if (isInterceptionCandidate() && (hasCdiBoundInterceptors() ||
hasDirectlyDefinedInterceptors()))
{
InterceptionUtils.executePostConstruct(instance);
}
else
{
getInjectionTarget().postConstruct(instance);
}
return instance;
}
The code that is aware of interceptors needs to be sucked into
InjectionTarget.postConstruct(), since a portable extension can't easily reproduce
that logic. create() should look like:
public T create(CreationalContext<T> creationalContext)
{
T instance = getInjectionTarget().produce(creationalContext);
getInjectionTarget().inject(instance, creationalContext);
getInjectionTarget().postConstruct(instance);
return instance;
}
Same goes for destroy().
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira