https://blog.csdn.net/u012343297/article/details/79163977
********************************************************
以前一直使用mysql或oracle结合mybatis实现数据持久化,今天需要使用sqlite,研究了一下,再查查资料,搭建成功,现将过程记录下来,以为备忘。
1、首先添加依赖包
spring boot依赖
<!-- Inherit defaults from Spring Boot --> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.4.0.BUILD-SNAPSHOT</version> </parent> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>
sqlite依赖
<dependency> <groupId>org.xerial</groupId> <artifactId>sqlite-jdbc</artifactId> <version>3.21.0.1</version> </dependency>
mybatis依赖
<dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1.2.0</version> </dependency>
2、添加application.propertise
#spring.datasource.url=jdbc:sqlite::resource:example.db spring.datasource.url=jdbc:sqlite:C:/db/example.db spring.datasource.username= spring.datasource.password= spring.datasource.driver-class-name=org.sqlite.JDBC mybatis.typeAliasesPackage=org.spring.springboot.domain mybatis.mapperLocations=classpath:mapper/*.xml server.port=8888
完成之后,配置基本完成,就可以通过添加xml和dao进行数据的CRUD测试。