我是 Boot 和mysql的新手。我正在尝试在application.yml文件中创建一个带有mysql配置的API。我的yml文件如下所示。
datasource:
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/test
username:
password:
jpa:
hibernate.ddl-auto: update
generate-ddl: true
show-sql: true
问题是我不想把我的密码放在yaml文件中。我想使用一个密钥文件或一个不记名令牌。我不知道我该如何开始。请帮助。提前感谢:)
2条答案
按热度按时间ngynwnxp1#
你可以在这里使用Jasypt来加密数据库密码。你可以把它和**ENC()**key放在一起:--
Spring启动的Jasypt POM依赖性:--
(For项目不使用@SpringBootApplication或@EnableAutoConfiguration,则可以直接使用jasypt-spring-boot依赖项)其他:--
想要了解如何加密/解密Jasypt键点击:Jasypt
关于Jasypt jasypt github的更多详情
zf2sa74q2#
新的**驱动程序类是-com.mysql.cj.jdbc.驱动程序