SpringBoot在集成activiti6時,保存流程圖亂碼

@Bean
    public ProcessEngine processEngine(PlatformTransactionManager transactionManager, DataSource dataSource) throws IOException {
        SpringProcessEngineConfiguration configuration = new SpringProcessEngineConfiguration();
        //自動部署已有的流程文件
        Resource[] resources = new PathMatchingResourcePatternResolver().getResources(ResourceLoader.CLASSPATH_URL_PREFIX + "processes/*.bpmn");
        configuration.setDeploymentResources(resources);
        configuration.setTransactionManager(transactionManager);
        configuration.setDataSource(dataSource);
        configuration.setDatabaseSchemaUpdate("true");

        //使用這種方式不生效
        configuration.setActivityFontName("宋體");
        configuration.setAnnotationFontName("宋體");
        configuration.setLabelFontName("宋體");

        return configuration.buildProcessEngine();
    }

debug發如今程序運行時,使用的字體仍是默認的 Arialgit

這時咱們能夠經過一下方式解決ide

@Configuration
public class ActivitiConfig implements ProcessEngineConfigurationConfigurer {

    /**
     * 解決工做流生成圖片亂碼問題
     *
     * @param processEngineConfiguration processEngineConfiguration
     */
    @Override
    public void configure(SpringProcessEngineConfiguration processEngineConfiguration) {
        processEngineConfiguration.setActivityFontName("宋體");
        processEngineConfiguration.setAnnotationFontName("宋體");
        processEngineConfiguration.setLabelFontName("宋體");
    }
}

完整的項目地址:https://gitee.com/fuyang_lipengjun/platform-plus字體

相關文章
相關標籤/搜索