[英]Connection to database without knowing of login and password
My project interacts with database (executes usual CRUD operations).我的项目与数据库交互(执行通常的 CRUD 操作)。 For connection to database I wrote login and password in application.properties:
为了连接到数据库,我在 application.properties 中写了登录名和密码:
spring.datasource.username=root
spring.datasource.password=root
This approach works only if I work on my desktop with my account in mysql.仅当我使用 mysql 中的帐户在桌面上工作时,此方法才有效。
I want to transfer my project to another desktop with another account in mysql.我想用 mysql 中的另一个帐户将我的项目转移到另一个桌面。 I want the person who will get my project can run my app with one click, without writing his username/password in application.properties.
我希望获得我项目的人可以一键运行我的应用程序,而无需在 application.properties 中写入他的用户名/密码。
I don't know the username and password of this person.我不知道这个人的用户名和密码。 So I cann't write its to application.properties.
所以我不能把它写到application.properties。
I researched this problem and found this question: Start spring-boot app without depending on username and password for Database oracle?我研究了这个问题,发现了这个问题: Start spring-boot app without依赖于数据库oracle的用户名和密码?
The author of this question wants the person will pass authentication in web.此问题的作者希望此人将通过 web 中的身份验证。 But I want there won't necessity for person to enter any data except just run the program.
但我希望人们不需要输入任何数据,只需运行程序即可。
Is there any way to achieve it?有没有办法实现它?
There are ways that you can use:您可以使用以下几种方法:
Any more scenarios to think of?还有什么场景可以考虑?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.