MailConfiguration injected into MailComponent by Spring is ignored.
-------------------------------------------------------------------
Key: CAMEL-1249
URL: https://issues.apache.org/activemq/browse/CAMEL-1249
Project: Apache Camel
Issue Type: Bug
Components: camel-mail
Affects Versions: 1.5.0, 1.4.0
Environment: Camel
Reporter: Michael Chen
A Camel org.apache.camel.component.mail.MailComponent is configured via Spring
as:
{code}
<bean id="mailbox" class="org.apache.camel.component.mail.MailComponent">
<property name="configuration">
<bean id="mailbox_config"
class="org.apache.camel.component.mail.MailConfiguration">
<property name="protocol"><value>pop3</value></property>
<property name="host"><value>mail.abc.com</value></property>
<property name="username"><value>test</value></property>
<property name="password"><value>test</value></property>
</bean>
</property>
</bean>
{code}
It is silly to use the hard-coded URI in Java code to create a mail endpoint.
Instead I want to use the above method to specify everything (I mean
everything) about how to access a mail server (send or receive) in different
deployments. Up to Camel 1.5, line 73 of MailComponent.createEndpoint()
ignored the MailConfiguration variable MailComponent.configuration and created
a new one to parse the URI. This defeats the Spring injection above, which is
recommended by Camel's own User's Guide.
Line 73 and 74 should be changed from:
{quote}
MailConfiguration config = new MailConfiguration();
config.configure(url);
{quote}
to
{quote}
configuration.configure(url);
{quote}
In addition, if the uri parameter equals the component name, createEndpoint()
should not parse it at all, so that the following route builder will create the
mail endpoint solely according to the Spring injection of MailConfiguration:
{quote}
from("mailbox").to("my_queue");
{quote}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.