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

com.github.bingoohuang.sqltrigger.spring.SpringBeanFactory Maven / Gradle / Ivy

The newest version!
package com.github.bingoohuang.sqltrigger.spring;

import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

import java.util.Collection;

@Component
public class SpringBeanFactory implements ApplicationContextAware {
    private static ApplicationContext appContext;

    public static  Collection getBeans(Class clazz) {
        return appContext.getBeansOfType(clazz).values();
    }

    @Override public void setApplicationContext(ApplicationContext appContext) {
        this.appContext = appContext;
    }

    public static boolean isSpringEnabled() {
        return appContext != null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy