Skip to content
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

Fix #521 #522

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,27 +137,28 @@ private void buildFromMapperLocations(Configuration configuration, MyBatisRuntim
}
} catch (NullPointerException | IOException | URISyntaxException e) {
LOG.warnf("Not found mapper location :%s.", mapperLocation);
} catch (ClassNotFoundException e) {
LOG.warnf("Not found mapper class :%s.", e.getMessage());
}
}
});
}

private void buildXmlMapper(InputStream filterStream, InputStream resourceStream, String resource,
Configuration configuration,
String dataSourceName)
throws ClassNotFoundException {
String dataSourceName) {
final XPathParser xPathParser = new XPathParser(filterStream,
true, configuration.getVariables(), new XMLMapperEntityResolver());
String nameSpace = xPathParser.evalNode("/mapper").getStringAttribute("namespace");
final Class<?> mapperClass = Resources.classForName(nameSpace);
final MapperDataSource annotation = mapperClass.getAnnotation(MapperDataSource.class);
if ((annotation != null && annotation.value().equals(dataSourceName))
|| (annotation == null && dataSourceName.equals("<default>"))) {
XMLMapperBuilder xmlMapperBuilder = new XMLMapperBuilder(resourceStream,
configuration, resource, configuration.getSqlFragments());
xmlMapperBuilder.parse();
try {
final Class<?> mapperClass = Resources.classForName(nameSpace);
final MapperDataSource annotation = mapperClass.getAnnotation(MapperDataSource.class);
if ((annotation != null && annotation.value().equals(dataSourceName))
|| (annotation == null && dataSourceName.equals("<default>"))) {
XMLMapperBuilder xmlMapperBuilder = new XMLMapperBuilder(resourceStream,
configuration, resource, configuration.getSqlFragments());
xmlMapperBuilder.parse();
}
} catch (ClassNotFoundException e) {
LOG.warnf("Not found mapper class :%s.", e.getMessage());
}
}

Expand Down
Loading