add api context and logout
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package com.iconplus.smartproc.helper.context;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
|
||||
public class ContextProvider implements ApplicationContextAware {
|
||||
|
||||
private static ApplicationContext CONTEXT;
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
CONTEXT = applicationContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Spring bean by type.
|
||||
**/
|
||||
public static <T> T getBean(Class<T> beanClass) {
|
||||
return CONTEXT.getBean(beanClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Spring bean by name.
|
||||
**/
|
||||
public static Object getBean(String beanName) {
|
||||
return CONTEXT.getBean(beanName);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user