Search code examples
springactiviti

Loading Custom activiti.cfg.xml


I am learning activiti.
Where I created one java application in that I am using hibernate + Spring + activiti where we have activiti.cfg.xml.
I want to load only database details like datasource and hibernate properties programatically, other thing e.g asyncExecutorActivate, etc I want to do using activiti.cfg.xml.

e.g
Following need to set using Programatically

<bean id="dataSource"  class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="<set_Using_Program>" />
    <property name="url" value="<set_Using_Program>" />
    <property name="username" value="<set_Using_Program>" />
    <property name="password" value="<set_Using_Program>" />
</bean>

This Information set using activiti.cgf.xml

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

    <bean id="runtimeService" factory-bean="processEngine"
          factory-method="getRuntimeService" />
    <bean id="taskService" factory-bean="processEngine"
          factory-method="getTaskService" />
    <bean id="repositoryService" factory-bean="processEngine"
          factory-method="getRepositoryService" />
</beans>

How to do?


Solution

  • You can simply inject your values from properties file and build your own engine based on them. such as data source. follow this tutorial

    You can also build extensions on them see userguide