one quick way around this is to do the following...
@ContextConfiguration
public class MyActivityMonitorTestCase extends
AbstractJUnit38SpringContextTests {
...
see
http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/bean/BeanRouteUsingSpringEndpointTest.java?view=markup
this unit test
that being said, I'm not sure whether CamelSprintTestSupport should/could
support these annotations...
Xavier Coulon wrote:
>
> Hello,
>
> I'm running into a NullPointerException in my test case below:
>
> public class MyActivityMonitorTestCase
> extends CamelSpringTestSupport {
>
> @Autowired
> private MyActivityMonitor activityMonitor;
>
> @EndpointInject(uri = "mock:mock")
> private MockEndpoint mockEndpoint;
>
> @Override
> protected AbstractApplicationContext createApplicationContext() {
> return new ClassPathXmlApplicationContext(new String[] {
> "classpath*:/META-INF/spring/applicationContext-xyz1.xml",
> "classpath:/META-INF/spring/applicationContext-xyz2.xml" });
> }
>
> }
>
> The bean named 'activityMonitor' is created within the Spring Application
> context, but it is not injected in the test case, because I'm extending
> the
> CamelSpringTestSupport class, not the AbstractJUnit4SupportTestCase.
> I did not find any documentation about such a feature (injecting beans),
> but
> would it be something doable or is there a mistake/somthing missing in my
> code ?
> In the mean time, I can manually retrieve the bean from the
> applicationContext, but using annotation would be nicer ;-)
>
> Thank you in advance
> Regards,
> --
> Xavier
>
-----
Ben O'Day
IT Consultant -http://benoday.blogspot.com
--
View this message in context:
http://camel.465427.n5.nabble.com/CamelSpringTestSupport-and-support-for-Autowired-Inject-tp4383959p4385989.html
Sent from the Camel - Users mailing list archive at Nabble.com.