如何为在EC2实例上运行的Spring Boot项目配置AWS RDS?

问题描述 投票:1回答:1

我有一个从我的Spring Boot项目运行jar的AWS EC2 Linux实例。我创建了一个AWS RDS Postgres实例,并且试图从在EC2实例中运行的服务中调用它。我主要遇到配置问题。下面,我尝试在我的spring application.properties文件中进行以下配置:

cloud.aws.rds.capstoneinstance
cloud.aws.rds.capstoneinstance.password = mypassword
cloud.aws.rds.capstoneinstance.username = myusername
cloud.aws.rds.capstoneinstance.readReplicaSupport = true
cloud.aws.rds.capstoneinstance.databaseName = mydbname

这是我的Gradle导入:

implementation("org.springframework.cloud:spring-cloud-aws-jdbc:2.1.2.RELEASE")

我的程序甚至无法运行,但我相信那是因为spring正在寻找'spring.datasource.url'等。

这是输出:

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class


Action:

Consider the following:
    If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
    If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
spring amazon-web-services spring-boot amazon-ec2 amazon-rds
1个回答
0
投票

对项目使用JDBC配置。

© www.soinside.com 2019 - 2024. All rights reserved.