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

Failed to bind properties under ‘spring.datasource.type’ to java.lang.Class<javax.sql.DataSource>.
問題詳情如下:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-06-04 8:27:01.386 ERROR 11568 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to bind properties under 'spring.datasource.type' to java.lang.Class<javax.sql.DataSource>:

    Property: spring.datasource.type
    Value: com.alibaba.druid.pool.DruidDataSource
    Origin: class path resource [application.properties]:25:24
    Reason: No converter found capable of converting from type [java.lang.String] to type [java.lang.Class<javax.sql.DataSource>]

Action:

Update your application's configuration

Disconnected from the target VM, address: '127.0.0.1:51477', transport: 'socket'

Process finished with exit code 0

解決方法:
配置文件pom.xml中添加依賴,問題解決

<!-- 引入Druid依賴,阿里巴巴所提供的數據源 -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid-spring-boot-starter</artifactId>
            <version>1.1.13</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.47</version>
        </dependency>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章