[
https://issues.apache.org/jira/browse/DELTASPIKE-1060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15085583#comment-15085583
]
Martin Kouba commented on DELTASPIKE-1060:
------------------------------------------
[~hwellmann] Good questions. I'm not really sure it should work. One of the
concerns is that in the first snippet you're creating de facto an independent
instance of interceptor (which somehow contradicts the interceptor lifecycle
definition). On the other hand it could solve some special integration
scenarios/use cases. In any case, the usage mentioned above is something only a
really advanced user should dive into.
bq. Should there be an official API for creating a CreationalContext linked to
a given parent context?
Well, we would have to introduce a concept of {{CreationalContext}} *parent*
first.
> @Intercepted does not work with partial bean proxy
> --------------------------------------------------
>
> Key: DELTASPIKE-1060
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-1060
> Project: DeltaSpike
> Issue Type: Bug
> Components: Proxy-Module
> Affects Versions: 1.5.2
> Reporter: Harald Wellmann
> Assignee: Harald Wellmann
> Priority: Minor
> Attachments: deltaspike1060.tgz
>
>
> For a partial bean with an interceptor binding and an interceptor which
> injects the intercepted bean, e.g.
> {code}
> @Inject
> @Intercepted
> private Bean<?> intercepted;
> {code}
> Weld 2.2+ throws the following exception when an intercepted method of the
> partial bean is invoked:
> {noformat}
> Caused by: org.jboss.weld.exceptions.IllegalArgumentException: WELD-001549:
> Unable to determine parent creational context of
> org.jboss.weld.context.CreationalContextImpl@4841524b
> at
> org.jboss.weld.bean.builtin.AbstractBuiltInMetadataBean.getParentCreationalContext(AbstractBuiltInMetadataBean.java:65)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.bean.builtin.InterceptedBeanMetadataBean.newInstance(InterceptedBeanMetadataBean.java:62)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.bean.builtin.InterceptedBeanMetadataBean.newInstance(InterceptedBeanMetadataBean.java:47)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.bean.builtin.AbstractBuiltInMetadataBean.create(AbstractBuiltInMetadataBean.java:53)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:69)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:761)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:861)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:92)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:375)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:386)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.injection.producer.ResourceInjector$1.proceed(ResourceInjector.java:70)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:72)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:121)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:159)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.apache.deltaspike.proxy.impl.invocation.ManualInvocationContext.proceed(ManualInvocationContext.java:84)
> at
> org.apache.deltaspike.proxy.impl.invocation.AbstractManualInvocationHandler.invoke(AbstractManualInvocationHandler.java:48)
> at
> org.apache.deltaspike.proxy.impl.invocation.DelegateManualInvocationHandler.staticInvoke(DelegateManualInvocationHandler.java:39)
> at demo.CustomerDao$$DSPartialBeanProxy.findBy(Unknown Source)
> {noformat}
> The problem was discovered trying to port an application from WildFly
> 9.0.1.Final to 10.0.0.CR5. In WildFly 10, the Narayana transactional
> interceptor implementation does inject the intercepted bean, which was not
> the case in WildFly 9.
> The problem can be reproduced also on WildFly 9 with a simple demo
> interceptor. I'll attach a sample project.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)