Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could
问题分析及解决方案
问题原因: Mybatis没有找到合适的加载类,其实是大部分spring - datasource - url没有加载成功,分析原因如下所示.
-
DataSourceAutoConfiguration会自动加载.
-
没有配置spring - datasource - url 属性.
-
spring - datasource - url 配置的地址格式有问题.
-
配置 spring - datasource - url的文件没有加载.
-
方法1:
-
@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class})
方法2:
spring: datasource: url: jdbc:mysql://localhost:3306/read_data?useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: 123456 driver-class-name: com.mysql.jdbc.Driver