PackageScanDefinition missing public setter methods making it difficult to
configure CamelContext via CamelContextFactoryBean using regular Spring
definition
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: CAMEL-1997
URL: https://issues.apache.org/activemq/browse/CAMEL-1997
Project: Apache Camel
Issue Type: Bug
Components: camel-core
Affects Versions: 2.0.0
Environment: N/A
Reporter: Alan Feng
Priority: Minor
In order to use spring features like "depends-on" and
PropertyPlaceholderConfigure, it is desirable to configure the CamelContext
using the standard Spring boolean definition (bean and property tags, etc),
instead of the shortcut xbean style definition (<camelContext> tag).
However, the org.apache.camel.spring.CamelContextFactoryBean, which is
typically used to configure the CamelContext bean, uses the
org.apache.camel.model.PackageScanDefinition class to hold the package scanning
information. This class does not have any public setter for its private
properties and can only be configured via xbean. This makes it very hard to
configure the CamelContext bean using the standard Spring bean definition.
Please add the public setters to this class so it can be used by Spring
directly.
At present, a workaround is to implement a subclass of the
org.apache.camel.model.PackageScanDefinition to add the missing setters. A
sample Spring definition would look like this:
<bean id="camel" class="org.apache.camel.spring.CamelContextFactoryBean"
depends-on="my-other-bean">
<property name="trace" value="false"/>
<property name="packageScan">
<bean class="com.mypackage.CamelPackageScanDefinition">
<property
name="packageList"><value>${route.packageScan}</value></property>
</bean>
</property>
</bean>
<bean id="template"
class="org.apache.camel.spring.CamelProducerTemplateFactoryBean">
<property name="camelContext" ref="camel"/>
</bean>
In the above sample, the CamelPackageScanDefinition is the custom subclass.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.