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

com.github.dts.sdk.util.SpringUtil Maven / Gradle / Ivy

package com.github.dts.sdk.util;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;

public class SpringUtil {
    public static Object getBean(BeanFactory beanFactory, String beanName, Class type) {
        Object redisConnectionFactory;
        try {
            redisConnectionFactory = beanFactory.getBean(beanName);
        } catch (BeansException e) {
            redisConnectionFactory = beanFactory.getBean(type);
        }
        return redisConnectionFactory;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy