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

org.zodiac.autoconfigure.mybatis.extension.MyBatisPluginFollowConfigurationCustomizerConfig Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.autoconfigure.mybatis.extension;

import java.util.Map;

import org.apache.ibatis.session.Configuration;
import org.mybatis.spring.boot.autoconfigure.ConfigurationCustomizer;
import org.springframework.context.ApplicationContext;
import org.zodiac.commons.util.spring.Springs;
import org.zodiac.mybatis.extension.MyBatisPluginFollowCoreConfig;
import org.zodiac.mybatis.extension.SpringBootMyBatisExtension;

public class MyBatisPluginFollowConfigurationCustomizerConfig extends MyBatisPluginFollowCoreConfig {

    public MyBatisPluginFollowConfigurationCustomizerConfig(ApplicationContext mainApplicationContext) {
        super(mainApplicationContext);
    }

    @Override
    protected void processConfiguration(SpringBootMyBatisExtension.Type type, Configuration configuration) {
        super.processConfiguration(type, configuration);
        if (type == SpringBootMyBatisExtension.Type.MYBATIS) {
            try {
                Map customizerMap = Springs.getBeansMap(getMainApplicationContext(), ConfigurationCustomizer.class);
                if (!customizerMap.isEmpty()) {
                    for (ConfigurationCustomizer customizer : customizerMap.values()) {
                        customizer.customize(configuration);
                    }
                }
            } catch (Exception e) {
                // ignore
            }
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy