-
Notifications
You must be signed in to change notification settings - Fork 1.8k
There is case that cannot scan classes using SpringBootVFS #301
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
Comments
The valid workaround is changing the scanning base package to more nested package(e.g. NOET: |
This issue's root cause are following code in Lines 57 to 65 in ba00741
In this implementation, the MyBatis will try to scan the
New suggestion is as follow: @Override
protected List<String> list(URL url, String path) throws IOException {
String urlString = url.toString();
String baseUrlString = urlString.endsWith("/") ? urlString : urlString.concat("/");
Resource[] resources = resourceResolver.getResources(baseUrlString + "**/*.class");
return Stream.of(resources)
.map(resource -> preserveSubpackageName(baseUrlString, resource, path))
.collect(Collectors.toList());
}
private static String preserveSubpackageName(final String baseUrlString, final Resource resource, final String rootPath) {
try {
return rootPath + (rootPath.endsWith("/") ? "" : "/")
+ resource.getURL().toString().substring(baseUrlString.length());
} catch (IOException e) {
throw new UncheckedIOException(e);
}
} Above solution work fine on following runtime env:
|
@eddumelendez WDYT? Is correct my analysis and suggestion? |
Thanks for your report! |
Fix resources scanning bug on SpringBootVFS
Fix resources scanning bug on SpringBootVFS
Hi @kazuki43zoo , thank you very much. I have a little suggestion,
|
日本語にて失礼します。
|
@wamaco Thanks for your working!
I will consider to support it! |
@kazuki43zoo thanks, I have subscribed, and I'm learning from you. |
Overview
See mybatis/mybatis-3#1500.
Conditions that matches this issue
If following all conditions are matched, the
SpringBootVFS
cannot scan classes correctly.${HOME}/.m2/repository
)In this case, all conditions are matched as follow:
$HOME/.m2/repository/com/bee/kuna/kuna-server-db/0.1.1-RELEASE/kuna-server-db-0.1.1-RELEASE.jar
com.bee
com.bee.kuna
-> the groupId prefix is matched with scanning base package(com.bee
)Fix version
The text was updated successfully, but these errors were encountered: