Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SPRING - Get current scope

Tags:

spring

How can I access, throughout a Spring application, the current thread scope...

In other words, how can I identify if the current thread scope is a request or a system local thread ?

like image 789
ggdio Avatar asked Dec 26 '22 08:12

ggdio


1 Answers

Try with

if (RequestContextHolder.getRequestAttributes() != null) 
   // request thread
like image 123
Jose Luis Martin Avatar answered Mar 27 '23 15:03

Jose Luis Martin