- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我开始学习ibatis框架。我正在使用 Intellij 和 Maven。但也存在一些问题。我的主 java 类找不到我的 sql 配置 xml:
我的SqlMapConfig.xml应该在哪个目录中?
最佳答案
我从未使用过 mybatis,但从文档看来,您需要将 XML 添加到包中,然后在 main 方法中引用路径。
http://mybatis.github.io/mybatis-3/java-api.html
String resource = "org/mybatis/builder/mybatis-config.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
SqlSessionFactory factory = builder.build(inputStream);
org/mybatis/builder/mybatis-config.xml
位于 src/main/java/
关于java - 如何在maven项目中为sqlmapconfig.xml设置类路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32509723/
SqlMapConfig.xml配置文件的内容和配置顺序如下 properties(属性) settings(全局配置参数) typeAiases(类型别名) typeHandlers(类型
我正在处理 this MyBatis tutorial ,并归结为在 SqlMapConfig.xml 中设置数据源的问题。本教程使用 MySql,就像互联网上现有的所有其他教程一样,但我使用的是 S
我想使用 Eclipse 导出功能导出我的 Java 项目。我的项目包含许多 Spring 库。我右键单击项目/导出/JAR 文件,选择项目,检查项目的所有内容,指定主类。当我使用参数运行它时,会发生
我将 SqlMapConfig.xml 作为包保存在 src 文件夹中。当我为项目创建 jar 时,SqlMapCofig 以及映射器和属性文件将被复制到 jar 内。当我必须更改数据库连接用户名、密
我是一名优秀的程序员,十分优秀!