一.普通的dao,service对应的实例bean不存在
报错示例:
1.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。
2.
解决方案:
1.确实不存在,加进去就好了
2.类存在,但是spring没有扫描到,注意启动类所在位置,springboot默认扫描的是启动类所在目录下的子包和类,如下图1.2所示。另外可以使用@componentScan这个注解指定扫描的包:示例@componentScan({“xxx.xx”,"xxx.xx"})
二.由于bean的加载顺序和配置文件的关系
1.请参考以下博文
https://blog.youkuaiyun.com/J080624/article/details/80508606
https://blog.youkuaiyun.com/zhongzunfa/article/details/81988807
https://blog.youkuaiyun.com/leileibest_437147623/article/details/80898878