springboot2.0集成jdbc的数据源问题(已解决)

最近在学习springboot2.0,集成jdbc的时候老是给我报这个一个错误

Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-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).

大概意思就是:找不到spring.datasource.url这个属性的意思。在网上找了一万种方法,都不是,他们都是不要数据源的,可我这要配置数据源啊,而且格式、配置文件、存放位置什么的都对。

其实也是我的原因,我是看视频学的springboot2.0 ,视频里面老师用的eclipse,而我用的idea,可能是我创建工程的原因,导致我的跟视频里的 pom.xml内容有点不一样,之前没仔细看,后来一行一行的对才发现的问题,如下图
视频eclipse里的:
springboot2.0集成jdbc的数据源问题(已解决)_第1张图片
我的(idea):
springboot2.0集成jdbc的数据源问题(已解决)_第2张图片
之后我抱着试一试的态度,去掉了下面这行代码

pom

结果 神奇的事情发生了,ok了,困扰我一下午的事情解决了,苍天啊,泪崩。
至于什么原因,我不是很明白,望各位大佬给我解一下惑。

你可能感兴趣的:(SpringBoot)