Skip to content

java: 无法将类 java.lang.ThreadLocal<T>中的方法 withInitial应用到给定类型 #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jiayb opened this issue Sep 21, 2022 · 1 comment

Comments

@jiayb
Copy link

jiayb commented Sep 21, 2022

private static final ThreadLocal CONTEXT_HOLDER = ThreadLocal.withInitial(DataSourceKey.master);

java: 无法将类 java.lang.ThreadLocal中的方法 withInitial应用到给定类型;
需要: java.util.function.Supplier<? extends S>
找到: org.poem.enumeration.DataSourceKey
原因: 无法推断类型变量 S
(参数不匹配; org.poem.enumeration.DataSourceKey无法转换为java.util.function.Supplier<? extends S>)

报这个错

@helloworlde
Copy link
Owner

You can reference DynamicDataSourceContextHolder.java#L27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants