异常信息:
Description:
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).
这个异常是我在做微服务模块测试时出现的,在网上看了很多答案都没解决问题 。
网上的答案都是这种:
在启动类的@EnableAutoConfiguration或@SpringBootApplication中添加exclude = {DataSourceAutoConfiguration.class},排除此类的autoconfig 等等。。。。。。。。
但是对我没用!!!!!
我自己的解决方案:
由于系统运行时会去进行自动配置,那么是否是因为我的pom中添加了mybatis的相关jar包,导致boot的自动配置进行了mybatis的相关配置而出现的错误。
然后查看pom配置 :
发现的确是多了一个mybatis相关的jar包,移除和mybatis相关的Jar包
然后测试:
启动成功 !!