File tree Expand file tree Collapse file tree 3 files changed +5
-5
lines changed
tw-context/src/main/java/com/transferwise/common/context
src/main/java/com/transferwise/common/context Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ apply from: '../build.common.gradle'
7
7
dependencies {
8
8
implementation libraries. springBootAutoconfigure
9
9
implementation libraries. twBaseUtils
10
+ implementation libraries. micrometerContextPropagation
10
11
api project(" :tw-context:" )
11
12
12
13
testImplementation libraries. springBootStarterTest
Original file line number Diff line number Diff line change 12
12
@ Configuration
13
13
public class TwContextAutoConfiguration {
14
14
15
+ TwContextAutoConfiguration () {
16
+ ContextRegistry .getInstance ().registerThreadLocalAccessor (new TwContextThreadLocalAccessor ());
17
+ }
18
+
15
19
@ Bean
16
20
@ ConditionalOnMissingBean
17
21
public UnitOfWorkManager twContextUnitOfWorkManager (IMeterCache meterCache ) {
Original file line number Diff line number Diff line change 3
3
import com .google .common .annotations .VisibleForTesting ;
4
4
import com .google .common .util .concurrent .RateLimiter ;
5
5
import edu .umd .cs .findbugs .annotations .SuppressFBWarnings ;
6
- import io .micrometer .context .ContextRegistry ;
7
6
import java .util .HashMap ;
8
7
import java .util .Iterator ;
9
8
import java .util .List ;
@@ -40,10 +39,6 @@ public class TwContext {
40
39
41
40
static final TwContext ROOT_CONTEXT = new TwContext (null , true );
42
41
43
- static {
44
- ContextRegistry .getInstance ().registerThreadLocalAccessor (new TwContextThreadLocalAccessor ());
45
- }
46
-
47
42
public static TwContext current () {
48
43
Optional <TwContext > twContext = contextTl .get ();
49
44
return twContext == null || !twContext .isPresent () ? ROOT_CONTEXT : twContext .get ();
You can’t perform that action at this time.
0 commit comments