io.github.pleuvoir.sql.kit.ApplicationContextUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sql-metadata-plugin Show documentation
Show all versions of sql-metadata-plugin Show documentation
Execute SQL to return result set metadata easily.
package io.github.pleuvoir.sql.kit;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
public class ApplicationContextUtil implements ApplicationContextAware {
private static ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
ApplicationContextUtil.applicationContext = applicationContext;
}
public static T getBean(Class requiredType) {
return applicationContext.getBean(requiredType);
}
}