小编Sp *_*sha的帖子

具有环境变量的Spring Boot配置

我有一个Spring Boot应用程序,它与DB交互以使用Spring Data Rest提供资源。我想从环境变量中获取配置。以下是我的属性文件。

spring.datasource.url=${mysql.url}
spring.datasource.username=${mysql.user}
spring.datasource.password=${mysql.password}
Run Code Online (Sandbox Code Playgroud)

我的环境变量在图像https://ibb.co/cyxsNc中

我什至尝试了以下配置

spring.datasource.url=${MySQL_Url}
spring.datasource.username=${MySQL_User}
spring.datasource.password=${MySQL_Password}
Run Code Online (Sandbox Code Playgroud)

但是我无法连接到数据库并出现以下错误

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.tomcat.jdbc.pool.DataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalArgumentException: URL must start with 'jdbc'
Run Code Online (Sandbox Code Playgroud)

应用程序文件夹结构

Project
|-- src/main/java
    |-- com.example.app
        |-- DemoApplication.java …
Run Code Online (Sandbox Code Playgroud)

spring spring-boot

5
推荐指数
2
解决办法
1万
查看次数

如何在电子应用程序中加密 SQLite DB?

我有一个电子应用程序,它将数据保存在存储在我的机器中的 SQLite 数据库中。我已经完成了 CRUD 操作的所有设置,并且应用程序运行良好。现在我需要加密 SQLite DB 文件。我在网上搜索解决方案,但所有解决方案都是针对预加密的数据库,该数据库正在电子内部解密。

要求是,用户将提供应用程序用于加密数据库文件的密码,并且用户将提供用于解密和执行 CRUD 操作的密码

知道如何实现这一目标吗?

PS:我检查过 SQLCipher 文档,但没有找到我需要的东西。到目前为止,我正在使用sqlite3节点模块来执行 CRUD

编辑1:我尝试使用sqlite-cipher模块,并且能够在单独的 js 文件中加密数据库。但是当我将其与电子 ipcMain 集成时,应用程序由于高 RAM 消耗而关闭。有什么建议么???

sqlite sqlcipher electron

5
推荐指数
1
解决办法
3329
查看次数

标签 统计

electron ×1

spring ×1

spring-boot ×1

sqlcipher ×1

sqlite ×1