java - Spring Boot 和 Teradata UnsatisfiedDependencyException

标签 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

最佳答案

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

关于java - Spring Boot 和 Teradata UnsatisfiedDependencyException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40653520/

相关文章:

teradata - 使用 VirtualBox 启动 Teradata Express VM

sql - Teradata 中的子字符串和修剪

java - Neo4j 2.0,java - 无法使用较旧的数据存储版本启动 Neo4j

java - 如何将 EJB 公开为 Web 服务,以便稍后在 ejb 更改时让我保持客户端兼容性?

Java for 循环没有正确填充数组

java - 升级 Spring Integration 版本后出现类转换异常

java - JAXB2基础知识可合并插件: Setting a custom Merge Strategy

java - com.sun.proxy.$Proxy219 无法使用 Java Config 进行转换,但它可以与 xml 一起正常工作

java - 在 Spring MVC 中更改过滤器类中的语言环境

teradata - 如何查找列名与特定模式匹配的所有表/ View