TokenUtil
This commit is contained in:
@ -0,0 +1,23 @@
|
|||||||
|
package com.chinaunicom.mall.ebtp.common.base.util;
|
||||||
|
|
||||||
|
import com.chinaunicom.mall.ebtp.common.base.entity.BaseCacheUser;
|
||||||
|
import com.chinaunicom.mall.ebtp.common.base.service.impl.BaseCacheUserServiceImpl;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.ApplicationContextAware;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class TokenUtil implements ApplicationContextAware {
|
||||||
|
|
||||||
|
private static ApplicationContext context;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setApplicationContext(ApplicationContext applicationContext) {
|
||||||
|
context = applicationContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BaseCacheUser getCurrentUser() {
|
||||||
|
BaseCacheUserServiceImpl service = context.getBean(BaseCacheUserServiceImpl.class);
|
||||||
|
return service.getCacheUser();
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user