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

com.aiyi.core.SqlSourceConfig Maven / Gradle / Ivy

There is a newer version: 0.3.8.RELEASE
Show newest version
package com.aiyi.core;

import com.aiyi.core.enums.SqlType;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @Author: 郭胜凯
 * @Date: 2019-07-23 16:20
 * @Email [email protected]
 * @Description: 数据源配置
 */
@Component
public class SqlSourceConfig {

    private static SqlType type;

    @Value("${spring.datasource.driver-class-name}")
    private String driverClass;

    @PostConstruct
    public void init(){
        if (driverClass.toUpperCase().contains(SqlType.MYSQL.name())){
            type = SqlType.MYSQL;
        }
        if (driverClass.toUpperCase().contains(SqlType.ORACLE.name())){
            type = SqlType.ORACLE;
        }
    }

    public static SqlType getType(){
        return type;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy