SecurityContextHolder.getContext().getAuthentication(
) returning null
when i call inside a @Async
method. Tried to use SecurityContextHolder.MODE_INHERITABLETHREADLOCAL
strategy. but it doesn't work
<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>
used inside applicationContext-security.xml and applicationContext.xml as well