Springboot+JPA+Sqlite整合demo参考: https://afu-bob.blog.csdn.net/article/details/90294553
简单使用:
1.依赖
<!-- https://mvnrepository.com/artifact/com.github.gwenn/sqlite-dialect --> <dependency> <groupId>com.github.gwenn</groupId> <artifactId>sqlite-dialect</artifactId> <version>0.1.0</version> </dependency> <!-- https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc --> <dependency> <groupId>org.xerial</groupId> <artifactId>sqlite-jdbc</artifactId> <version>3.28.0</version> </dependency>
2. properties 配置文件上 data source 配置
# 数据库连接信息 JDBC url spring.datasource.url=jdbc:sqlite:D://data/sqlite/test.db # 数据库驱动名称 spring.datasource.driverClassName=org.sqlite.JDBC # 数据库用户名 spring.datasource.username= # 数据库密码 spring.datasource.password= # Dialect spring.jpa.database-platform=org.hibernate.dialect.SQLiteDialect # spring.jpa.hibernate.use-new-id-generator-mappings=true spring.jpa.generate-ddl=true spring.jpa.hibernate.ddl-auto=update spring.jpa.show-sql=false spring.jpa.properties.hibernate.format_sql=true spring.jpa.open-in-view=true # logging.level.org.hibernate.type.descriptor.sql.BasicBinder=trace
然后就可以正常使用了