Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Won't Fix
-
3.0.0.RC3
-
None
-
None
-
OS: Window 10 / 1809
java version "11.0.3" 2019-04-16 LTS
Spring: 2.2.0.RELEASE
-
Unknown
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 as 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.xm_l (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)
}
@Slf4j
@Component
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class ValueChangedProcessor implements Processor
}
}}
// 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>
```