我将以下属性添加到 my 中application.properties以将敏感帐户信息与主应用程序分开。
#/src/main/resources/application.properties
spring.config.additional-location=/etc/java/myapp/
spring.datasource.url=jdbc:mysql://localhost/mytable
额外的:
#/etc/java/myapp/application.properties:
spring.datasource.username=theuser
spring.datasource.password=thepw
结果:未找到属性!
java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO)
我在这里做错了什么?
旁注:如果我添加默认值,问题仍然存在。属性不会被覆盖!
spring.datasource.username=replaceme spring.datasource.password=replaceme
结果: java.sql.SQLException: Access denied for user 'replaceme'@'localhost' (using password: YES)
相关分类