4

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

M. Deinum
  • 115,695
  • 22
  • 220
  • 224
user3132347
  • 363
  • 1
  • 7
  • 27

0 Answers0