AnsweredAssumed Answered

Simplest possible Spring integration

Question asked by awagner99 on Sep 26, 2013
Latest reply on Aug 6, 2014 by martin.grofcik
Hi all,

I'm new to activiti, trying to integrate it into a simple spring MVC app, and I'm missing something. I'm trying to do the simplest possible thing, keeping everything in memory. Here's everything I've done:

pom.xml
+               <dependency>
+                   <groupId>org.activiti</groupId>
+                       <artifactId>activiti-spring</artifactId>
+                       <version>5.13</version>
+               </dependency> 

DomainObject.java
+       @Autowired
+       private RuntimeService runtimeService;

+               runtimeService.startProcessInstanceByKey("vacationRequest", variables);
+                    
+               logger.info("Number of process instances: " + runtimeService.createProcessInstanceQuery().count());

applicationContext.xml
+       <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration"/>
+      
+       <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
+               <property name="processEngineConfiguration" ref="processEngineConfiguration" />
+       </bean>
+
+       <bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" />

servlet-context.xml
+       <context:component-scan base-package="org.activiti"/>

The error that I'm getting is a classic:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [org.activiti.engine.RuntimeService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}


I've tried a lot of different combinations of things, but this seems like the simplest possible thing that should work. What am I missing?

Outcomes