When trying to load the application context from the SpringJunit4ClassRunner for unit test cases throwing exception.
java.lang.IllegalStateException: Failed to load ApplicationContext Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mailingThreadService' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException Caused by: java.lang.IllegalArgumentException
The code is as follows
public class XXXXThreadServiceImpl extends BaseXXXXServiceImpl
implements XXXXThreadService, Runnable {
public void initialize() {
}
}
In application context file for spring is as follows
<bean id="mailingThreadService" class="com.xd.mailinglist.services.impl.MailingThreadServiceImpl"
init-method="initialize" destroy-method="shutdown" scope = "singleton">
<property name="serviceAgent" ref="cassNcoaServiceAgent"/>
<property name="dao" ref="addressDataService"/>
</bean>
The unit test goes here
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration( {"/applicationContext.xml"})
public class SomeServiceImplTest {
}
When we install using maven its throwing the following error:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mailingThreadService' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException