提交 | 用户 | 时间
|
1ac2bc
|
1 |
package cn.stylefeng.guns.config; |
懒 |
2 |
|
|
3 |
import org.activiti.engine.ProcessEngineConfiguration; |
|
4 |
import org.activiti.spring.SpringProcessEngineConfiguration; |
|
5 |
import org.springframework.beans.factory.annotation.Autowired; |
|
6 |
import org.springframework.context.ApplicationContext; |
|
7 |
import org.springframework.context.annotation.Bean; |
|
8 |
import org.springframework.context.annotation.Configuration; |
|
9 |
import org.springframework.transaction.PlatformTransactionManager; |
|
10 |
|
|
11 |
import javax.sql.DataSource; |
|
12 |
|
|
13 |
import static org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.*; |
|
14 |
|
|
15 |
/** |
|
16 |
* 工作流配置 |
|
17 |
* |
|
18 |
* @author fengshuonan |
|
19 |
* @Date 2019/8/5 22:07 |
|
20 |
*/ |
|
21 |
@Configuration |
|
22 |
public class ActivitiConfig { |
|
23 |
|
|
24 |
@Autowired |
|
25 |
PlatformTransactionManager transactionManager; |
|
26 |
|
|
27 |
@Autowired |
|
28 |
ApplicationContext applicationContext; |
|
29 |
|
|
30 |
@Bean |
|
31 |
public SpringProcessEngineConfiguration getProcessEngineConfiguration() { |
|
32 |
DataSource dataSource = applicationContext.getBean(DataSource.class); |
|
33 |
SpringProcessEngineConfiguration config = new SpringProcessEngineConfiguration(); |
|
34 |
config.setDataSource(dataSource); |
|
35 |
config.setDbIdentityUsed(false); |
|
36 |
config.setTransactionManager(transactionManager); |
|
37 |
config.setActivityFontName("宋体"); |
|
38 |
config.setLabelFontName("宋体"); |
|
39 |
config.setAnnotationFontName("宋体"); |
|
40 |
|
|
41 |
//使用别的数据库注意修改 |
|
42 |
config.setDatabaseType(DATABASE_TYPE_MSSQL); |
|
43 |
// config.setDatabaseType(DATABASE_TYPE_MYSQL); |
|
44 |
//初始化工作流数据库用 |
|
45 |
config.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE); |
|
46 |
|
|
47 |
return config; |
|
48 |
} |
|
49 |
|
|
50 |
} |