SecurityContextHolder.getContext().getAuthentication(
)当我在null
方法中调用时返回@Async
。试图使用SecurityContextHolder.MODE_INHERITABLETHREADLOCAL
策略。但它不起作用
<bean
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetClass" value="org.springframework.security.core.context.SecurityContextHolder" />
<property name="targetMethod" value="setStrategyName" />
<property name="arguments" value="MODE_INHERITABLETHREADLOCAL" />
</bean>
在applicationContext-security.xml和applicationContext.xml中使用