import com.jiuqi.bi.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
/**
* @Description:获取数据库的类型
*/
@Configuration
public class DataBaseType {
private static final Logger log = LoggerFactory.getLogger(DataBaseType.class);
private static final String ORACLE = "oracle";
@Value("${spring.datasource.driver-class-name:#{null}}")
private String datasource;
/**
* 判断是否是oracle数据库
* @return
*/
public Boolean isOracleDataBase(){
log.info("datasource:"+datasource);
if(StringUtils.isNotEmpty(datasource) && datasource.indexOf(ORACLE)>-1){
return true;
}
return false;
}
}
Note: You can play freely according to your needs and judge other database types