项目场景:
SpringBoot,启动类启动BUG
问题描述:
创建启动类,启动报错了
***************************
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).
原因分析:
没有配置数据库,启动时候,会自动找数据库配置
解决方案:
1、添加上数据库配置
2、在启动类添加属性,默认不去加载数据库配置 (exclude = DataSourceAutoConfiguration.class)
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
public class OSSApplication {
public static void main(String[] args) {
SpringApplication.run(OSSApplication.class,args);
}
}
最后
以上就是儒雅长颈鹿最近收集整理的关于SpringBoot启动报错项目场景:问题描述:原因分析:解决方案:的全部内容,更多相关SpringBoot启动报错项目场景内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复