| | |
| | | package org.ruoyi.common.core.utils; |
| | | |
| | | import cn.hutool.extra.spring.SpringUtil; |
| | | import org.springframework.aop.framework.AopContext; |
| | | import org.springframework.beans.factory.NoSuchBeanDefinitionException; |
| | | import org.springframework.boot.autoconfigure.thread.Threading; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.core.env.Environment; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public static <T> T getAopProxy(T invoker) { |
| | | return (T) AopContext.currentProxy(); |
| | | return (T) getBean(invoker.getClass()); |
| | | } |
| | | |
| | | |
| | |
| | | return getApplicationContext(); |
| | | } |
| | | |
| | | public static boolean isVirtual() { |
| | | return Threading.VIRTUAL.isActive(getBean(Environment.class)); |
| | | } |
| | | |
| | | } |