Spring Boot和Teradata UnsatisfiedDependencyException

时间:2016-11-17 11:17:24

标签: java spring teradata

我正在尝试使用Teradata数据库创建一个简单的Spring应用程序。

它正在使用mySql数据库和驱动程序,但在更改为Teradata驱动程序/数据库后,我收到以下异常:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.tomcat.jdbc.pool.DataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalArgumentException: URL must start with 'jdbc'

应用程序属性:

spring.datasource.url =jdbc:teradata://servername/db
spring.datasource.username = dbc
spring.datasource.password = dbc
spring.datasource.driverClassName=com.ncr.teradata.TeraDriver

1 个答案:

答案 0 :(得分:1)

我认为这是Spring的问题,你可能在构造函数上使用@Autowire但是spring不能使用该名称注入类。要解决这个问题,只需在您的上下文中定义一个DataSource - 此时Spring将能够注入bean并正确引导上下文。