cancel
Showing results for 
Search instead for 
Did you mean: 

Autowiring does not work with org.activiti.engine.test.ActivitiRule

wsalembi
Champ in-the-making
Champ in-the-making
We had an issue with our spring beans not being autowired in our unit tests.

Our activiti.cfg.xml file contains 
<context:annotation-config/>

We call a JavaDelegate class using activiti:delegateExpression

  
 <serviceTask id="checkValidName" name="CheckValidName" activiti:delegateExpression="${nameChecker}"></serviceTask>


The cause of the problem is ActivitiRule who delegates to org.activiti.engine.impl.cfg.BeansConfigurationHelper:Smiley TonguearseProcessEngineConfiguration to instantiate the spring context using DefaultListableBeanFactory. Because no ApplicationContext is used, the
<context:annotation-config/> 
seems to be ignored.

(BeanFactory only supports the older Autowire collaborators mechanism. http://static.springsource.org/spring/docs/3.0.0.RELEASE/reference/htmlsingle/#beans-factory-autowir...)

If we instantiate the Spring context ourselves in the unit test using ClassPathXmlApplicationContext, we have no issues with autowiring.

Is it possible to review the implementation of BeansConfigurationHelper to use an application context instead of beanFactory?
1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.