【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
-
无法配置DataSource:未指定
URL
属性,也无法配置嵌入数据源 -
就是你在应用中没有配置datasource的一些相关属性
都知道,SpringBoot的最大一个好处就是自动配置:所以我们只是需要给他配置文件的值,它就会自动配置。配置在application.yml文件中
这里不需要配置,声明一下启动类头部声明就可以了
/**
* @author 庭前云落
* @Date 2019/12/13 10:57
* @description
*/
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@EnableEurekaClient
@EnableFeignClients
public class ClientApplication {
public static void main(String[] args) {
SpringApplication.run(ClientApplication.class,args);
}
}
)
来源:oschina
链接:https://my.oschina.net/u/4233685/blog/3142732