Amazon web services 春云RDS,你好世界

Amazon web services 春云RDS,你好世界,amazon-web-services,spring-boot,spring-cloud,rds,Amazon Web Services,Spring Boot,Spring Cloud,Rds,我是SpringCloud的新手,想写一个简单的“HelloWorld”RDS程序 我的配置存储在xml配置中,如下所示 <aws-context:context-credentials> ... </aws-context:context-credentials> <aws-context:context-region region="ap-southeast-1" /> <jdbc:data-source db-instance-ident

我是SpringCloud的新手,想写一个简单的“HelloWorld”RDS程序

我的配置存储在xml配置中,如下所示

<aws-context:context-credentials>
    ...
</aws-context:context-credentials>
<aws-context:context-region region="ap-southeast-1" />

<jdbc:data-source db-instance-identifier="amazonrds"
    password="${password}" read-replica-support="false">
    <jdbc:pool-attributes initialSize="1"
        defaultCatalog="Records" testOnBorrow="true" validationQuery="SELECT 1" />
</jdbc:data-source>
我知道我丢失了一些连接器,但我不知道是什么。当前它在构建时抛出此错误

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jdbcRecordService' defined in file [C:\Users\codev\gitlab\springaws\target\classes\base\rds\JdbcRecordService.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.apache.tomcat.jdbc.pool.DataSource]: : No qualifying bean of type [org.apache.tomcat.jdbc.pool.DataSource] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.apache.tomcat.jdbc.pool.DataSource] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
它基本上是说,没有一个bean候选者可以用数据源参数自动连接构造。我错过了什么


编辑:我的问题通过在我的POM.xml中重新排序文件得到了解决。我仍然不知道是哪个特定的依赖项冲突导致了这个问题,但只是将
aws java sdk
移到依赖项列表的顶部就解决了我的问题。

如果spring读取或不读取,请尝试在aws-config.xml中输入一个拼写错误。当我在那里出错时,我会收到xml错误。@Codevalley在自动连接之前,必须为jdbcTemplate创建bean。如果spring读取或未读取,请尝试在aws-config.xml中键入。当出现错误时,我会收到xml错误。@Codevalley您必须在自动连接之前为jdbcTemplate创建bean。
@SpringBootApplication
@EnableAutoConfiguration
@Configuration
@ComponentScan
@ImportResource("classpath:aws-config.xml")
public class SpringBootAwsApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringBootAwsApplication.class, args);
    }
}
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jdbcRecordService' defined in file [C:\Users\codev\gitlab\springaws\target\classes\base\rds\JdbcRecordService.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.apache.tomcat.jdbc.pool.DataSource]: : No qualifying bean of type [org.apache.tomcat.jdbc.pool.DataSource] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.apache.tomcat.jdbc.pool.DataSource] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}