我正在开发一个带有DB存储库的java项目,遇到了一个愚蠢的问题。我使用的是MySQL和Mybatis3.4.5。位于resources/mybatis文件夹中的配置文件(mybatis-config.xml)。
我试着通过下面的代码来读取它:
public class MySQLAttrRepo implements AttrRepo {
public static final String CONFIGURATION_XML = "mybatis/mybatis-config.xml";
private InputStream inputStream = Resources.getResourceAsStream(CONFIGURATION_XML);
}但是得到一个异常
java.io.IOException: Could not find resource mybatis/mybatis-config.xml我做错了什么?
发布于 2020-02-06 20:11:26
已修复。原因是pom.xml中的包装错误。我设置了"pom“而不是"jar”。
https://stackoverflow.com/questions/60084189
复制相似问题