一、报错1:找不到url
1、报错信息
2020-12-02 13:30:34.916 ERROR 7056 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
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).
2、排查方法
首先排查建包是否有问题,持久层和业务层的包都必须是在主程序的包的子包下面,这样才能被注入。
此时的目录:
没有问题。
确认没有问题之后,再去排查,持久层和业务层里面的注解是否正确,在持久层里面的Dao 接口
中应当以 @Mapper
进行注解,在业务层的 Servcie 类
中应当以 @Service
进行注解。
排查后上面说的问题都没问题,所以把目光转向主启动类:
此时的主启动类:
@SpringBootApplication
public class DeptProvider_8001 {
public static void main<