Hi all,
This is a little annoying
I defined an MPDClient bean here but looks like Autowiring it here returns null yet it works in Test classes that extend BaseModuleContextSensitiveTest eg this. Could I be missing something here?
Hi all,
This is a little annoying
I defined an MPDClient bean here but looks like Autowiring it here returns null yet it works in Test classes that extend BaseModuleContextSensitiveTest eg this. Could I be missing something here?
@samuel34, if MPDClientClassBuilder is not spring-managed, then I don’t think you will be able to wire beans into it . Also, not sure if this is also an issue, but using both @Component and defining the bean within your applicationcontext.xml file will result in two instances of the same bean in the context, I believe.
Mike
@samuel34 because there is no spring application context in your test, BaseModuleContextSensitiveTest has one because it extends AbstractJUnit4SpringContextTests which sets up and provides the application context.
What’s the best trending practice in the sense of wiring beans , Annotation vs moduleApplicationContext.xml ?
Annotations could be probably better but a debate was loosely raised on this. It was realized that they slow down the system as compared to moduleApplicationContext.xml .
cc: @raff