package com.cf.imes.framework.datasource.config;

import com.baomidou.dynamic.datasource.event.DataSourceInitEvent;
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration;
import com.cf.imes.framework.mybatis.core.event.ChenfengDataSourceEncryptInitEvent;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;


/**
 * @author Gqr
 * @since 2024/8/26 18:20
 */
@AutoConfiguration(before = DynamicDataSourceAutoConfiguration.class)
@ConditionalOnProperty(name = "chenfeng.encrypt.enable", havingValue = "true")
public class ChenfengDataSourceEncryptConfiguration {
    @Bean
    public DataSourceInitEvent getDataSourceInitEvent() {
        return new ChenfengDataSourceEncryptInitEvent();
    }
}
