问答详情
源自:2-4 Mybatis自动生成器使用方式

配置了德鲁伊连接池后项目启动失败

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]:6: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


==============================================================================

pom中配置

<dependency>

  <groupId>com.alibaba</groupId>

  <artifactId>druid</artifactId>

  <version>1.1.3</version>

  </dependency>

================================================================================

application.properties中


mybatis.mapperLocations=classpath:mapping/*.xml

spring.datasource.name=miaosha

spring.datasource.url=jdbc:mysql://localhost:3306/miaosha

spring.datasource.username=root

spring.datasource.passwork=123456

spring.datasource.type=com.alibaba.druid.pool.DruidDataSource

spring.datasource.driverClassName=com.jdbc.mysql.Driver


提问者:慕容9408899 2018-12-23 01:22

个回答

  • 龙虾三少
    2018-12-23 11:13:16
    已采纳

    spring.datasource.passwork=123456  password拼错了

  • 慕容9408899
    2018-12-23 14:45:42

    spring.datasource.driverClassName=com.jdbc.mysql.Driver  检查后发现这个也写错了,改正com.mysql.jdbc.Driver  后启动成功了