The SecurityContextHolder in Spring Security has three operation modes that determine how and where the SecurityContext is stored per thread/request:


🔐 1. MODE_THREADLOCAL (Default)

java
CopyEdit
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_THREADLOCAL);


🔄 2. MODE_INHERITABLETHREADLOCAL

java
CopyEdit
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL);


🧵 3. MODE_GLOBAL