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