[ 
https://issues.apache.org/jira/browse/CAMEL-6160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13602227#comment-13602227
 ] 

Daniel Ford commented on CAMEL-6160:
------------------------------------

Ok, thanks.  I see that the solution offered by CAMEL-5494 isn't available 
until 2.11.0, I'll have to wait for that.  The bug would then appear to be in 
the documentation.  This page http://camel.apache.org/testing.html only 
mentions JavaConfigContextLoader, and doesn't mention any of its limitations.  
Also, after a search on google, it would appear that the existence of 
CamelSpringDelegatingTestContextLoader is not documented anywhere other than 
the CAMEL-5494 bug and the SVN commit message.

Would there be a problem with switching to use 
CamelSpringDelegatingTestContextLoader in the future?  I found it extremely 
confusing, not to mention time consuming to figure out, that 
CamelSpringJUnit4ClassRunner changes the semantics of @ContextConfiguration 
from what its superclass SpringJUnit4ClassRunner supports.  I expect a 
continuous parade of developers will trudge down the same path I did.
                
> CamelSpringJUnit4ClassRunner ignores annotation based context configurations.
> -----------------------------------------------------------------------------
>
>                 Key: CAMEL-6160
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6160
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-test
>    Affects Versions: 2.10.4
>         Environment: Windows 7, Java 1.7.0_17, Spring 3.2.1
>            Reporter: Daniel Ford
>            Assignee: Willem Jiang
>              Labels: test
>
> In a Camel/Spring JUnit4 test case, if you specify:
> @RunWith(CamelSpringJUnit4ClassRunner.class)
> @ContextConfiguration(classes = { FooCamelConfig.class })
> then the context configuration (including the definition of CamelContext) 
> defined in FooCamelConfig.java, using Java Annotations, will be ignored.  If 
> you change to use SpringJUnit4ClassRunner, then the configuration will be 
> processed.
> The problem is in the two implementations of the method 
> "loadBeanDefintions()"  in the class CamelSpringTestContextLoader.  They both 
> exclusively use XmlBeanDefinitionReader to load bean definitions into the 
> context, so no beans defined using annotations are ever read/loaded.
> If you use the SpringJUnit4ClassRunner, then it includes the use of 
> AnnotationConfigContextLoader which, in turn, uses 
> AnnotatedBeanDefinitionReader to read/load beans defined with annotations.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to