新建Spring boot 启动报错 Failed to auto-configure a DataSource
今天学习springboot,使用idea创建项目。在选择组件时添加了mysq 然后在第一次启动的时候启动报错,错误信息如下:
***************************
APPLICATION FAILED TO START
***************************
Description:
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).
在多方查证后,需要在启动类的@EnableAutoConfiguration或@SpringBootApplication中添加exclude
= {DataSourceAutoConfiguration.class},排除此类的autoconfig。启动以后就可以正常运行。
这是因为添加了数据库组件,所以autoconfig会去读取数据源配置,而我新建的项目还没有配置数据源,所以会导致异常出现。
解决问题方法2:不用改动添加语句,注意项目文件结构的正确性
新建Spring boot 启动报错 Failed to auto-configure a DataSource的更多相关文章
- Spring boot 启动报错 Failed to auto-configure a DataSource
1.Spring boot 启动报错 Failed to auto-configure a DataSource 参考资料https://blog.csdn.net/liuyinfei_java/ar ...
- spring Boot启动报错Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotatedElementUtils.getAnnotationAttributes
spring boot 启动报错如下 org.springframework.context.ApplicationContextException: Unable to start web serv ...
- 解决spring boot启动报错java.lang.NoClassDefFoundError: ch/qos/logback/classic/Level
解决spring boot启动报错java.lang.NoClassDefFoundError: ch/qos/logback/classic/Level 学习了:https://blog.csdn. ...
- 【原创】大叔经验分享(67)spring boot启动报错
spring boot 启动报错: Caused by: java.lang.IllegalArgumentException: LoggerFactory is not a Logback Logg ...
- spring boot 启动报错(spring-boot-devtools热部署后):The elements [spring.resources.cache-period] were left unbound. Update your application's configuration
详细错误代码: *************************** APPLICATION FAILED TO START *************************** Descript ...
- Spring Boot 启动报错 Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 37
使用命令 java -jar springBoot.jar 启动项目,结果报错如下: Exception at java.lang.String.substring(String.java:) at ...
- spring boot启动报错Error starting ApplicationContext(未能配置数据源)
主要错误:Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource c ...
- Spring Boot 启动报错:LoggingFailureAnalysisReporter
17:57:19: Executing task 'bootRun'... Parallel execution with configuration on demand is an incubati ...
- Spring boot 启动报错:com.mongodb.MongoSocketOpenException: Exception opening socket
详细错误信息: com.mongodb.MongoSocketOpenException: Exception opening socket at com.mongodb.connection.Soc ...
随机推荐
- spark教程(12)-生态与原理
spark 是目前非常流行的大数据计算框架. spark 生态 Spark core:包含 spark 的基本功能,定义了 RDD 的 API,其他 spark 库都基于 RDD 和 spark co ...
- windows系统下nginx+tomcat+redis做负载均衡和session粘滞附整套解决方案
Nginx: 在nginx-1.8.0\conf目录下找到nginx.conf文件,打开文件修改文件中http{}中的内容,在http{}中加入 upstream localhost { serve ...
- MyBatis的foreach查询(List、Array、Map)
mybatis 中 foreach collection的三种用法 foreach的主要用在构建in条件中,它可以在SQL语句中进行迭代一个集合. foreach元素的属性主要有 item,index ...
- 第一个SpringMVC应用流程总结
- Nginx之常用操作
1) 将XXX.com 重定向到 www.XXX.com server { client_max_body_size 20m; listen ; server_name www.xxx.com xxx ...
- JDBC2
1.JDBC连接池 public class JdbcTemplateDemo2 { //Junit单元测试,可以让方法独立执行 //1. 获取JDBCTemplate对象 private JdbcT ...
- Linux6上安装MySQL
MySQL安装包下载:https://www.mysql.com/downloads/ 然后选择: 把下载好的安装包传到服务器上的指定目录,然后解压: [root@master mysql]# tar ...
- 码流回调过快导致下方处理不及时socket阻塞问题
在一个情形中遇到下面一个情况 简述下该图片,对sdk进行二次开发,通过第三方sdk接口获取码流信息.具体实现方式是通过回调函数CallBack_SDK来不停的回调第三方服务的视频流.起初实现逻辑如下: ...
- Linux中FTP服务器配置
1.FTP服务器的一些基本概念 (1)FTP连接方式 控制连接:标准端口为21,用于发送FTP命令信息. 数据连接:标准端口为20,用于上传.下载数据. ...
- 斐波那契数列 Java 不同的实现方法所需要的时间比较
# 首先我们直接看一个demo以及他的结果 public class QQ { public static void main(String[] args) throws ParseException ...