You can set the environment variable spring.security.strategy
to MODE_INHERITABLETHREADLOCAL
. You could also have a simple bean that during your web applications startup calls SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL)
and initialize that value in your context configuration file.
SecurityContextHolder API
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…