[ https://issues.apache.org/jira/browse/CAMEL-12610?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Work on CAMEL-12610 started by Willem Jiang. -------------------------------------------- > Camel bean component invokes cached instance of bean in Registry > ---------------------------------------------------------------- > > Key: CAMEL-12610 > URL: https://issues.apache.org/jira/browse/CAMEL-12610 > Project: Camel > Issue Type: Bug > Components: camel-core > Affects Versions: 2.20.0, 2.20.1, 2.20.2, 2.20.3, 2.21.0, 2.21.1, 2.22.0 > Environment: N/A > Reporter: Jan Bednar > Assignee: Willem Jiang > Priority: Major > Attachments: Referring objects for originalInstance.png, Stack during > second invocation of SomeDependentBean.txt > > > Related SO question: > [https://stackoverflow.com/questions/51108913/camel-bean-component-invokes-cached-instance-of-named-dependent-bean] > Every invocation of bean component should query Registry for actual instance. > Now it is cached in {{BeanProcessor#delegate}} variable, even if endpoint > parameter {{cache=false}} specified. > This behavior breaks java-ee compliance: > [https://docs.oracle.com/javaee/7/api/javax/enterprise/context/Dependent.html] > {quote}Every invocation of the [{{Context.get(Contextual, > CreationalContext)}}|https://docs.oracle.com/javaee/7/api/javax/enterprise/context/spi/Context.html#get-javax.enterprise.context.spi.Contextual-javax.enterprise.context.spi.CreationalContext-] > operation of the context object for the {{@Dependent}} scope returns a new > instance of the given bean. > {quote} > Marking this as Major, because upgrading of Camel from 2.19.x to 2.2x.x leads > to unpredictable results in CDI environment. Since this is tied to CDI > environment, this issue is hard to notice even in well junit covered > application and can result in major issues in pre-production or production > environment. > Full reproducible project with unit test and deployable WAR package, which > passes with 2.19.x and lower. Fails with 2.20.x and higher [on > Github|https://github.com/bedlaj/camel-dependent-bean]. > Attachments are based on version 2.21.1 -- This message was sent by Atlassian JIRA (v7.6.3#76005)