Failed to bind properties under ‘spring.datasource.type’ to java.lang.Class的解决方法

怼烎@ 2023-02-15 03:42 86阅读 0赞

Failed to bind properties under ‘spring.datasource.type’ to java.lang.Class.
问题详情如下:

  1. Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
  2. 2020-06-04 8:27:01.386 ERROR 11568 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
  3. ***************************
  4. APPLICATION FAILED TO START
  5. ***************************
  6. Description:
  7. Failed to bind properties under 'spring.datasource.type' to java.lang.Class<javax.sql.DataSource>:
  8. Property: spring.datasource.type
  9. Value: com.alibaba.druid.pool.DruidDataSource
  10. Origin: class path resource [application.properties]:25:24
  11. Reason: No converter found capable of converting from type [java.lang.String] to type [java.lang.Class<javax.sql.DataSource>]
  12. Action:
  13. Update your application's configuration
  14. Disconnected from the target VM, address: '127.0.0.1:51477', transport: 'socket'
  15. Process finished with exit code 0

解决方法:
配置文件pom.xml中添加依赖,问题解决

  1. <!-- 引入Druid依赖,阿里巴巴所提供的数据源 -->
  2. <dependency>
  3. <groupId>com.alibaba</groupId>
  4. <artifactId>druid-spring-boot-starter</artifactId>
  5. <version>1.1.13</version>
  6. </dependency>
  7. <dependency>
  8. <groupId>com.alibaba</groupId>
  9. <artifactId>fastjson</artifactId>
  10. <version>1.2.47</version>
  11. </dependency>

发表评论

表情:
评论列表 (有 0 条评论,86人围观)

还没有评论,来说两句吧...

相关阅读