All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.mengweijin.config.FlowableSpringProcessEngineBeanPostProcessor Maven / Gradle / Ivy

Go to download

Flyway、Liquibase 扩展支持达梦(DM)数据库、南大通用(GBase 8s)数据库。

There is a newer version: 2.0.2
Show newest version
package com.github.mengweijin.config;

import org.flowable.common.engine.impl.AbstractEngineConfiguration;
import org.flowable.common.engine.impl.util.ReflectUtil;
import org.flowable.spring.SpringProcessEngineConfiguration;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Configuration;
import org.springframework.lang.Nullable;
import java.lang.reflect.Field;
import java.util.Properties;

/**
 * @author mengweijin
 */
@Configuration
@ConditionalOnClass({SpringProcessEngineConfiguration.class})
public class FlowableSpringProcessEngineBeanPostProcessor implements BeanPostProcessor {

    @Override
    public Object postProcessAfterInitialization(@Nullable Object bean, @Nullable String beanName) throws BeansException {
        if(bean instanceof SpringProcessEngineConfiguration) {
            Properties databaseTypeMappings = SpringProcessEngineConfiguration.getDefaultDatabaseTypeMappings();
            databaseTypeMappings.setProperty("DM DBMS", AbstractEngineConfiguration.DATABASE_TYPE_ORACLE);

            Field field = ReflectUtil.getField("databaseTypeMappings", bean);
            ReflectUtil.setField(field, bean, databaseTypeMappings);
        }

        return bean;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy