【发布时间】:2017-03-15 08:54:19
【问题描述】:
我有 myBatis xml 配置 SqlMapConfig.xml
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE configuration
PUBLIC '-//mybatis.org//DTD Config 3.0//EN'
'http://mybatis.org/dtd/mybatis-3-config.dtd'>
<configuration>
<!--<typeAliases>-->
<!--<typeAlias alias = "class_alias_Name" type = "absolute_clas_Name"/>-->
<!--</typeAliases>-->
<environments default = "development">
<environment id = "development">
<transactionManager type = "JDBC"/>
<dataSource type = "POOLED">
<property name = "driver" value = "oracle.jdbc.driver.OracleDriver"/>
<property name = "url" value = "jdbc:oracle:thin:@my_ip:port/dbname"/>
<property name = "username" value = "username"/>
<property name = "password" value = "password"/>
</dataSource>
</environment>
</environments>
<!--<mappers>-->
<!--<mapper resource = "path of the configuration XML file"/>-->
<!--</mappers>-->
</configuration>
我有依赖
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.1.1</version>
</dependency>
我有仓库
@Mapper
public interface ImsiByMsisdnModelRepository {
final String query = "....";
@Select(query )
@Results(value = {
@Result(property = "msisdn", column = "MSISDN"),
@Result(property = "terminalid", column = "TERMINALID"),
@Result(property = "startDate", column = "START_DATE"),
@Result(property = "endDate", column = "END_DATE"),
})
List<ImsiByMsisdnModel> getAll(@Param("msisdn") String msisdn);
}
但是当我尝试构建项目时,我得到了错误
说明:
无法确定数据库类型 NONE 的嵌入式数据库驱动程序类
行动:
如果您想要一个嵌入式数据库,请在 类路径。如果您有要从 您可能需要激活它的特定配置文件(没有配置文件是 目前处于活动状态)。
我可以设置SqlMapConfig.xml 吗?
我尝试写在application.properties 行
mybatis.config-location=
但是我不知道是哪个路径写的。 SqlMapConfig.xml放在资源里
【问题讨论】:
-
您的其他 spring-boot 依赖项是什么? Alo,请向我们展示您的完整 application.properties
-
我也有同样的问题,你知道如何添加主机吗?我有你相同的 SqlMapConfig.xml,在我的 application.properties 我有: spring.datasource.schema=import.sql #mybatis.configuration=mybatis-config.xml mybatis.config-location=mybatis-config.xml logging.level .root=WARN logging.level.sample.mybatis.mapper=TRACE
标签: spring-boot ibatis spring-mybatis