1

我有一个 Spring Boot 应用程序,我正在尝试连接到 RDS 实例(MySQL)。这是我的应用程序

@SpringBootApplication
@EnableRdsInstance(databaseName="*****", dbInstanceIdentifier="****", username="****",password="******")
@EnableContextCredentials(accessKey="*****", secretKey="****")
@EnableContextRegion(region="****")
public class Application extends SpringBootServletInitializer{

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(Application.class);
    }

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
} 

当我尝试时mvn spring-boot:run

我收到以下错误:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dubba': Invocation of init method failed; nested exception is java.lang.IllegalStateException: No database type found for engine:'aurora'
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:736)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:957)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:946)
    at sample.traditional.config.Application.main(Application.java:26)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
4

1 回答 1

0

这是因为 Aurora 没有正式在框架中(Spring Cloud for Amazon Web Services),尽管它基本上是 MySQL。

它是 1.1.0 版本的一部分,截至今天 (11.5.2016) 为稳定版本

Maven依赖:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-aws-jdbc</artifactId>
    <version>1.1.0.RC2</version>
</dependency>

当发布版本在 Maven 上可用时,只需将 RC2 替换为 RELEASE。

于 2016-05-10T17:54:39.213 回答