[
https://issues.apache.org/jira/browse/CAMEL-14488?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Thomas Thiele updated CAMEL-14488:
----------------------------------
Description:
After switch from apache-camel.version 3.0.0-M2 to 3.0.0-RC3 annotation
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
seems not to work usual.
Complete sample project is attached
(camel-prototype-verification.2020-02-04.7z).
Run test: ``mvn clean package`` /or run test folder in your IDE.)
For test you may switch the apache-camel.version in pom.xml (see ``TODO``).
Sample:
{{In a camel route with reference to both classes, the _ValueChangedFilter_
class is instantiated
every time the _ValueChangedFilter.matches (Exchange exchange)_ method is
called.
Class _ValueChangedProcessor_ is instantiated only once (as expected).
In apache-camel.version 3.0.0-M2 both classes are treated the same (like class
_ValueChangedProcessor_).
```
@Component
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class ValueChangedFilter {
public boolean matches(Exchange exchange)
{ // do something ... }
}
@Slf4j
@Component
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class ValueChangedProcessor implements Processor {
@Override
public void process(Exchange exchange)
{ // do something ... }
}
}}
// CamelRoutes:
?xml version="1.0" encoding="UTF-8"?>
<routes xmlns="http://camel.apache.org/schema/spring">
<route id="filterRoute">
<from uri="direct:GENERATOR_Filter_EntryPoint"/>
<filter>
<method ref="valueChangedFilter" method="matches(${exchange})"/>
<stop/>
</filter>
<to uri="mock:messageReceiverFilter"/>
</route>
<route id="processorRoute">
<from uri="direct:GENERATOR_to_Processor_EntryPoint"/>
<process ref="valueChangedProcessor"/>
<to uri="mock:messageReceiverProcessor"/>
</route>
</routes>
```
was:
After switch from apache-camel.version 3.0.0-M2 to 3.0.0-RC3 annotation
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
seems not to work usual.
Complete sample project is attached
(camel-prototype-verification.2020-02-04.7z).
Run test: ``mvn clean package`` /or run test folder in your IDE.)
For test you may switch the apache-camel.version in pom.xml (see ``TODO``).
Sample:
{{In a camel route with reference to both classes, the _ValueChangedFilter_
class is instantiated
every time the _ValueChangedFilter.matches (Exchange exchange)_ method is
called.
Class _ValueChangedProcessor_ is instantiated only once (as expected).
In apache-camel.version 3.0.0-M2 both classes are treated the same (like class
_ValueChangedProcessor_).
```
@Component
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class ValueChangedFilter {
public boolean matches(Exchange exchange) {
// do something ...
}
}
@Slf4j
@Component
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class ValueChangedProcessor implements Processor {
@Override
public void process(Exchange exchange)
{ // do something ... }
}
}}
// CamelRoutes:
?xml version="1.0" encoding="UTF-8"?>
<routes xmlns="http://camel.apache.org/schema/spring">
<route id="filterRoute">
<from uri="direct:GENERATOR_Filter_EntryPoint"/>
<filter>
<method ref="valueChangedFilter" method="matches(${exchange})"/>
<stop/>
</filter>
<to uri="mock:messageReceiverFilter"/>
</route>
<route id="processorRoute">
<from uri="direct:GENERATOR_to_Processor_EntryPoint"/>
<process ref="valueChangedProcessor"/>
<to uri="mock:messageReceiverProcessor"/>
</route>
</routes>
```
> SCOPE_PROTOTYPE doesn't work always (apache-camel.version 3.0.0-RC3)
> --------------------------------------------------------------------
>
> Key: CAMEL-14488
> URL: https://issues.apache.org/jira/browse/CAMEL-14488
> Project: Camel
> Issue Type: Bug
> Components: camel-spring
> Affects Versions: 3.0.0.RC3
> Environment: OS: Window 10 / 1809
> java version "11.0.3" 2019-04-16 LTS
> Spring: 2.2.0.RELEASE
> Reporter: Thomas Thiele
> Priority: Critical
> Attachments: camel-prototype-verification.2020-02-04.7z
>
>
> After switch from apache-camel.version 3.0.0-M2 to 3.0.0-RC3 annotation
> @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
> seems not to work usual.
> Complete sample project is attached
> (camel-prototype-verification.2020-02-04.7z).
> Run test: ``mvn clean package`` /or run test folder in your IDE.)
> For test you may switch the apache-camel.version in pom.xml (see ``TODO``).
> Sample:
> {{In a camel route with reference to both classes, the _ValueChangedFilter_
> class is instantiated
> every time the _ValueChangedFilter.matches (Exchange exchange)_ method is
> called.
> Class _ValueChangedProcessor_ is instantiated only once (as expected).
> In apache-camel.version 3.0.0-M2 both classes are treated the same (like
> class _ValueChangedProcessor_).
> ```
> @Component
> @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
> public class ValueChangedFilter {
> public boolean matches(Exchange exchange)
> { // do something ... }
> }
> @Slf4j
> @Component
> @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
> public class ValueChangedProcessor implements Processor {
> @Override
> public void process(Exchange exchange)
> { // do something ... }
> }
> }}
> // CamelRoutes:
> ?xml version="1.0" encoding="UTF-8"?>
> <routes xmlns="http://camel.apache.org/schema/spring">
> <route id="filterRoute">
> <from uri="direct:GENERATOR_Filter_EntryPoint"/>
> <filter>
> <method ref="valueChangedFilter" method="matches(${exchange})"/>
> <stop/>
> </filter>
> <to uri="mock:messageReceiverFilter"/>
> </route>
> <route id="processorRoute">
> <from uri="direct:GENERATOR_to_Processor_EntryPoint"/>
> <process ref="valueChangedProcessor"/>
> <to uri="mock:messageReceiverProcessor"/>
> </route>
> </routes>
> ```
--
This message was sent by Atlassian Jira
(v8.3.4#803005)