1. 程式人生 > 實用技巧 >activiti-配置資料來源為PostgreSql

activiti-配置資料來源為PostgreSql

postgresql是資料庫型別為postgres

在yml中配置activiti引數

spring:
   activiti:
      database-type: postgres # 資料庫型別
      database-schema-update: true # 建表規則 為true會自動建立表
      db-history-used: false # 檢測歷史表是否存在

也可以在ActivitiConfig中直接配置

 /**
     * 流程配置,與spring整合採用SpringProcessEngineConfiguration這個實現
     * @param dataSource
     * @param transactionManager
     * @return
     */
    @Bean
    public ProcessEngineConfiguration processEngineConfiguration(DataSource dataSource, PlatformTransactionManager transactionManager){
        SpringProcessEngineConfiguration processEngineConfiguration = new SpringProcessEngineConfiguration();
        processEngineConfiguration.setDataSource(dataSource);
        processEngineConfiguration.setDatabaseSchemaUpdate("true");
        processEngineConfiguration.setDatabaseType("postgres");
        
        processEngineConfiguration.setTransactionManager(transactionManager);
        
        //流程圖字型
        processEngineConfiguration.setActivityFontName("宋體");
        processEngineConfiguration.setAnnotationFontName("宋體");
        processEngineConfiguration.setLabelFontName("宋體");
        
        return processEngineConfiguration;
    }