camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Xavier Coulon <xcou...@gmail.com>
Subject CamelSpringTestSupport and support for @Autowired/@Inject
Date Tue, 10 May 2011 08:25:30 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message