ggdio
ggdio

Reputation: 180

SPRING - Get current scope

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 ?

Upvotes: 8

Views: 4705

Answers (1)

Jose Luis Martin
Jose Luis Martin

Reputation: 10709

Try with

if (RequestContextHolder.getRequestAttributes() != null) 
   // request thread

Upvotes: 14

Related Questions