cancel
Showing results for 
Search instead for 
Did you mean: 

Process engine spring config file in web project

sureshtellakula
Champ in-the-making
Champ in-the-making
Hi,
I am using Activiti in my web project with Auto-deployment. As i am using auto-deployment,I am going with activiti spring configuration .
How i initialize my process engine when web project instance created. Can we use processEngine.init() method for activiti spring configuration.

Please provide me solution for this.

regards,
suresh kumar
3 REPLIES 3

frederikherema1
Star Contributor
Star Contributor
In the activiti REST, we use a ServletContextListener (org.activiti.rest.common.servlet.ActivitiServletContextListener) to get hold of the default process-engine. This is when you're not in a spring-context…

In spring-context, use:

<bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean" destroy-method="destroy">
   <property name="processEngineConfiguration" ref="processEngineConfiguration" />
  </bean>

If you have services that depend on the process-engine, the engine will be initialized when it's injected in your service for the first time (thats what a factory-bean is for) and will be resued by all services that depend on it. So once the app-context is booted, the engine is booted as wel. I presume you have a ApplicationContextServletContextListener (not sure what the exact name is in Spring) that initialises the spring-context when the webapp boots, so that's what you need…

sureshtellakula
Champ in-the-making
Champ in-the-making
Thank you for your feedback and present i have done POC from standalone application for Autodeployment. I need to implement Activiti Engine in web application with Auto-deployment. Please let me know what are the things i need to do.

regards,
suresh

frederikherema1
Star Contributor
Star Contributor
Take a look how the Activiti-explorer works. Basically, you'll need to wire up your spring-context in the servlet-context (e.g.. using a servlet-listener). A lot depends on the technology you want to use. But from the services you write, make sure you have access to the application-context and extract the process-engine from it (or inject it). Then, you can use our API from within any user-requests, using the framework of your choice.