-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb46a10
commit 488706b
Showing
3 changed files
with
153 additions
and
3 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/config/WxPayConfigHolder.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.github.binarywang.wxpay.config; | ||
|
||
/** | ||
* 微信支付配置策略. | ||
* | ||
* @author zenghao | ||
* @date 2021/3/12 | ||
*/ | ||
public class WxPayConfigHolder { | ||
|
||
private static final ThreadLocal<String> THREAD_LOCAL = ThreadLocal.withInitial(() -> "default"); | ||
|
||
/** | ||
* 获取当前微信支付配置策略. | ||
* @return 当前微信支付配置策略 | ||
*/ | ||
public static String get() { | ||
return THREAD_LOCAL.get(); | ||
} | ||
|
||
/** | ||
* 设置当前微信支付配置策略. | ||
* @param label 策略名称 | ||
*/ | ||
public static void set(final String label) { | ||
THREAD_LOCAL.set(label); | ||
} | ||
|
||
/** | ||
* 此方法需要用户根据自己程序代码,在适当位置手动触发调用,本SDK里无法判断调用时机. | ||
*/ | ||
public static void remove() { | ||
THREAD_LOCAL.remove(); | ||
} | ||
} |
This file contains 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
This file contains 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