[
https://issues.apache.org/activemq/browse/CAMEL-1205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=48367#action_48367
]
Claus Ibsen commented on CAMEL-1205:
------------------------------------
This is the correct stacktrace
{code}
java.lang.IllegalArgumentException: registry entry called myFileEndpoint of
type org.apache.camel.Endpoint must be specified
at org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:168)
at
org.apache.camel.util.CamelContextHelper.mandatoryLookup(CamelContextHelper.java:174)
at
org.apache.camel.util.CamelContextHelper.getEndpointInjection(CamelContextHelper.java:219)
at
org.apache.camel.impl.CamelPostProcessorHelper.getEndpointInjection(CamelPostProcessorHelper.java:120)
at
org.apache.camel.impl.CamelPostProcessorHelper.getInjectionValue(CamelPostProcessorHelper.java:132)
at
org.apache.camel.spring.CamelBeanPostProcessor.injectField(CamelBeanPostProcessor.java:143)
at
org.apache.camel.spring.CamelBeanPostProcessor$2.doWith(CamelBeanPostProcessor.java:132)
at
org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:523)
at
org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:500)
at
org.apache.camel.spring.CamelBeanPostProcessor.injectFields(CamelBeanPostProcessor.java:128)
at
org.apache.camel.spring.CamelBeanPostProcessor.postProcessBeforeInitialization(CamelBeanPostProcessor.java:76)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:350)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1331)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:341)
at
org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:111)
at
org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
at
org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:255)
at
org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests.runBare(AbstractJUnit38SpringContextTests.java:183)
at
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
{code}
On this unit test
{code:java}
@ContextConfiguration
public class SpringFileAntPathMatcherFilterTest extends
AbstractJUnit38SpringContextTests {
protected String expectedBody = "Godday World";
@Autowired
protected ProducerTemplate template;
@EndpointInject(name = "myFileEndpoint")
protected Endpoint inputFile;
@EndpointInject(uri = "mock:result")
protected MockEndpoint result;
public void testAntPatchMatherFilter() throws Exception {
result.expectedBodiesReceived(expectedBody);
template.sendBodyAndHeader(inputFile, "Hello World",
FileComponent.HEADER_FILE_NAME, "hello.txt");
template.sendBodyAndHeader(inputFile, "Bye World",
FileComponent.HEADER_FILE_NAME, "bye.xml");
template.sendBodyAndHeader(inputFile, expectedBody,
FileComponent.HEADER_FILE_NAME, "subfolder/godday.txt");
result.assertIsSatisfied();
}
@Override
protected void setUp() throws Exception {
TestSupport.deleteDirectory("target/antpathmatcher");
super.setUp();
}
}
{code}
> @EndpointInject can not lookup bean if endpoint is defined directly as a
> consumer (from)
> ----------------------------------------------------------------------------------------
>
> Key: CAMEL-1205
> URL: https://issues.apache.org/activemq/browse/CAMEL-1205
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-spring
> Affects Versions: 1.5.1, 2.0.0
> Reporter: Claus Ibsen
> Priority: Minor
>
> I was messing with camel-spring and routes using spring DSL
> I had this part of unit test code
> {code:java}
> @EndpointInject(name = "myFileEndpoint")
> protected Endpoint inputFile;
> {code}
> To lookup an endppoint with the given name *myFileEndpoint*
> But if I define it directly then it cannot be found
> {code:xml}
> <route>
> <from id="myFileEndpoint"
> uri="file://target/antpathmatcher?consumer.recursive=true&filter=#myFilter"/>
> <to uri="mock:result"/>
> </route>
> {code}
> So I have to define it as a loose endpoint as:
> {code:xml}
> <endpoint id="myFileEndpoint"
> uri="file://target/antpathmatcher?consumer.recursive=true&filter=#myFilter"/>
> <route>
> <from ref="myFileEndpoint"/>
> <to uri="mock:result"/>
> </route>
> {code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.