<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd">
<!-- Turn on annotation based configuration, etc. -->
<context:property-placeholder location="classpath*:*.properties" />
<!-- Use annotations to configure our components -->
<context:component-scan base-package="org.activiti" />
<!-- Turn on annotations for beans -->
<context:annotation-config />
<!-- Configure datasource -->
<bean id="dataSource" lazy-init="false"
class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy">
<property name="targetDataSource">
<bean class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
<property name="driverClass" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/activiti?autoReconnect=true&useUnicode=true&characterEncoding=utf-8" />
<property name="username" value="root" />
<property name="password" value="19841115" />
</bean>
</property>
</bean>
<!-- Configure transaction manager -->
<bean id="transactionManager" lazy-init="false"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<!-- Use transaction manager annotations -->
<tx:annotation-driven transaction-manager="transactionManager" />
<!-- Configure process engine -->
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration"
lazy-init="true">
<property name="databaseType" value="mysql" />
<property name="dataSource" ref="dataSource" />
<property name="transactionManager" ref="transactionManager" />
<property name="databaseSchemaUpdate" value="true" />
<property name="jobExecutorActivate" value="false" />
</bean>
<!-- Use process engine -->
<bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean"
lazy-init="true">
<property name="processEngineConfiguration" ref="processEngineConfiguration" />
</bean>
<!-- Use process engine service -->
<bean id="repositoryService" factory-bean="processEngine"
factory-method="getRepositoryService" lazy-init="true" />
<bean id="runtimeService" factory-bean="processEngine"
factory-method="getRuntimeService" lazy-init="true" />
<bean id="taskService" factory-bean="processEngine"
factory-method="getTaskService" lazy-init="true" />
<bean id="historyService" factory-bean="processEngine"
factory-method="getHistoryService" lazy-init="true" />
<bean id="managementService" factory-bean="processEngine"
factory-method="getManagementService" lazy-init="true" />
<bean id="identityService" factory-bean="processEngine"
factory-method="getIdentityService" lazy-init="true" />
</beans>
到此各项功能均能正常使用