Hi,
The default auto wiring mode for unit tests in the 'mock' module is autowire by type. I'd like to change this to autowire by name. How can I achieve this? I tried to use the setAutowireMode method, but oddly enough its not even visible in my unit test. Has anyone tried to do this before ?
Herez what my unit test looks like
The method signature of the API that I'm trying to use isCode:public class TransactionalTest extends AbstractTransactionalSpringContextTests { .... public TransactionalTest() { super(); //Next line causes a compiler error! setAutowireMode(AutowireCapableBeanFactory.AUTOWIRE_BY_NAME); } }
And this should be accessible. I can't make sense of this. Am I missing something?Code:public abstract class AbstractDependencyInjectionSpringContextTests ... { ... /** * Set the autowire mode for test properties set by Dependency Injection. * <p>The default is "AUTOWIRE_BY_TYPE". Can be set to "AUTOWIRE_BY_NAME" * or "AUTOWIRE_NO" instead. * @see #AUTOWIRE_BY_TYPE * @see #AUTOWIRE_BY_NAME * @see #AUTOWIRE_NO */ public final void setAutowireMode(int autowireMode) { this.autowireMode = autowireMode; } ... }
Thanks,
Radhakrishnan


Reply With Quote