Last active
January 7, 2020 06:35
-
-
Save magicliang/bebe002e95e6dee8be5336ea02ffaa7b to your computer and use it in GitHub Desktop.
一段 spring context 的 threadlocal 的用法
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private final ThreadLocal<TestContext> testContextHolder = ThreadLocal.withInitial( | |
// Implemented as an anonymous inner class instead of a lambda expression due to a bug | |
// in Eclipse IDE: "The blank final field testContext may not have been initialized" | |
new Supplier<TestContext>() { | |
@Override | |
public TestContext get() { | |
return copyTestContext(TestContextManager.this.testContext); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment