我目前正在处理一个项目,在该项目中我们的应用程序需要连接到 Amazon RDS 实例。到目前为止,我一直在使用以下文档进行设置: https ://cloud.spring.io/spring-cloud-aws/spring-cloud-aws.html#_sdk_credentials_configuration 。
根据文档,第 7.3 节,我应该这样设置我的 application.properties 文件:
cloud.aws.credentials.accessKey=XXXXXXXXXXXXXXX
cloud.aws.credentials.secretKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
cloud.aws.credentials.instanceProfile=true
cloud.aws.region.static=us-east-2
cloud.aws.rds.instanceNameTest
cloud.aws.rds.instanceNameTest.password=chownTestPW
cloud.aws.rds.instanceNameTest.username=dataTest1
cloud.aws.rds.instanceNameTest.databaseName=testDB
但是,当我运行应用程序时,我收到以下错误:
Caused by: java.lang.IllegalArgumentException: Password must not be null
at org.springframework.util.Assert.notNull(Assert.java:193) ~[spring-core-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.cloud.aws.jdbc.datasource.DataSourceInformation.<init>(DataSourceInformation.java:65) ~[spring-cloud-aws-jdbc-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.cloud.aws.jdbc.rds.AmazonRdsDataSourceFactoryBean.fromRdsInstance(AmazonRdsDataSourceFactoryBean.java:187) ~[spring-cloud-aws-jdbc-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.cloud.aws.jdbc.rds.AmazonRdsDataSourceFactoryBean.createDataSourceInstance(AmazonRdsDataSourceFactoryBean.java:153) ~[spring-cloud-aws-jdbc-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.cloud.aws.jdbc.rds.AmazonRdsDataSourceFactoryBean.createInstance(AmazonRdsDataSourceFactoryBean.java:130) ~[spring-cloud-aws-jdbc-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.cloud.aws.jdbc.rds.AmazonRdsDataSourceFactoryBean.createInstance(AmazonRdsDataSourceFactoryBean.java:45) ~[spring-cloud-aws-jdbc-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.beans.factory.config.AbstractFactoryBean.afterPropertiesSet(AbstractFactoryBean.java:141) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1765) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1702) ~[spring-beans-5.0.6.RELEASE.jar:5.0.6.RELEASE]
... 30 common frames omitted
我不确定为什么当上面的设置看起来很好时它告诉我密码为空。
任何的意见都将会有帮助。让我知道我是否需要提供其他任何东西。
谢谢。