前言

记录SpringBoot的相关报错信息

错误

无法引入@ResponseBody和@RequestMapping("/")

        <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

Failed to configure a DataSource: 'url'

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

source : https://www.cnblogs.com/javawxid/p/10949511.html

原因

1. DataSourceAutoConfiguration会自动加载.

2. 没有配置spring - datasource - url 属性.

3. spring - datasource - url 配置的地址格式有问题.

4. 配置 spring - datasource - url的文件没有加载.

解决

方案一 (解决原因1)[本人就是这种情况]
排除此类的autoconfig。启动以后就可以正常运行。 @SpringBootApplication(exclude= {DataSourceAutoConfiguration.class})
方案二 (解决原因2)
在application.properties/或者application.yml文件中没有添加数据库配置信息. spring:
datasource:
url: jdbc:mysql://localhost:3306/read_data?useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root
password: 123456
driver-class-name: com.mysql.jdbc.Driver
方案三 (解决原因3)
在spring xml配置文件中引用了数据库地址 所以需要对:等进行转义处理.但是在application.properties/或者application.yml文件并不需要转义,错误和正确方法写在下面了. //错误示例
spring.datasource.url = jdbc:mysql\://192.168.0.20\:1504/f_me?setUnicode=true&characterEncoding=utf8
//正确示例
spring.datasource.url = jdbc:mysql://192.168.0.20:1504/f_me?setUnicode=true&characterEncoding=utf8
方案四 (解决原因4)
yml或者properties文件没有被扫描到,需要在pom文件中<build></build>添加如下.来保证文件都能正常被扫描到并且加载成功. <!-- 如果不添加此节点mybatis的mapper.xml文件都会被漏掉。 -->
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.yml</include>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.yml</include>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>

SpringBoot——报错总结的更多相关文章

  1. SpringBoot报错:Failed to load ApplicationContext(javax.websocket.server.ServerContainer not available)

    引起条件: WebSocket+单元测试,单元测试报错! 解决方法: SpringBootTest增加webEnvironment参数. https://docs.spring.io/spring-b ...

  2. SpringBoot报错:java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String;

    错误:java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String ...

  3. springboot报错Whitelabel Error Page

    第一次使用springboot没有问题.隔了两天继续看.一直报错Whitelabel Error Page. 重新搭建试了任何方法都错了. 报的就是一个404错误,犯了一个习惯性错误,一般都是loca ...

  4. springboot报错Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean

    springboot项目在启动时需要把servlet容器编译进去,这时候如果你的maven依赖里面没有配置jetty或者tomcat相关依赖就会报错. 解决方法: jetty添加 <depend ...

  5. SpringBoot报错笔记

    异常一: 1.访问所有方法路径都返回一个page: 截图: 出错原因:不知道 解决方法:新建项目 异常二: 提交表单信息报错 原因:映射文件和和表单的提交方式不统一 解决方法:统一方式即可: 错误三: ...

  6. SpringBoot报错:nested exception is org.apache.ibatis.executor.ExecutorException: No constructor found in com.tuyrk.test.User matching [java.lang.Long, java.lang.String, java.lang.String]

    错误提示: Caused by: org.apache.ibatis.executor.ExecutorException: No constructor found in com.tuyrk._16 ...

  7. springboot 报错 Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported

    开始 controller 方法写的是 @RequestMapping( value = "/add", method = RequestMethod.POST ) public ...

  8. springboot 报错 org.springframework.beans.factory.NoSuchBeanDefinitionException:No qualifying bean of type 'com.example.service.HrService' available: 有没有大佬出个主意,我找了一天,刚入门springboot

    话不多说先上图,这是启动类的配置,这里配置了@ComponentScan("我的mapper的接口") 接下来是我的项目结构截图 然后是service 的截图,我在这里加了注解@S ...

  9. SpringBoot 报错: Circular view path [readingList] 解决办法

    spring boot报错: Circular view path [readingList]: would dispatch back to the current handler URL [/re ...

随机推荐

  1. 前端与算法 leetcode 36. 有效的数独

    目录 # 前端与算法 leetcode 36. 有效的数独 题目描述 概要 提示 解析 算法 传入[['5', '3', '.', '.', '7', '.', '.', '.', '.'],['6' ...

  2. [转帖]11G Undo使用率很高问题

    11G Undo使用率很高问题 http://blog.itpub.net/12679300/viewspace-1164916/ 原创 Oracle 作者:wzq609 时间:2014-05-20 ...

  3. golang学习笔记--函数和方法

    在go中,函数类型是一等类型,这意味着可以吧函数当做一个值来传递和使用. func divide(dividend int,divisor int)(int,error){ //省略部分代码 } 参数 ...

  4. vue实现跨域请求的设置

    vue实现跨域请求,需要在vue.config.js里添加以下设置 proxy: { '/service/rest': { target: 'http://localhost:8080/autotab ...

  5. texstudio基本设置

    一开始默认为英文,在上面菜单栏,“option” 1.设置中文:options->general->language->zh-cn 2.编辑和查看按钮: 3.设置默认编译器:选项-& ...

  6. Entity Framework 学习系列(3) - MySql Code First 开发方式+数据迁移

    目录 # 写在前面 一.开发环境 二.创建项目 三.安装程序包 四.创建模型 五.连接字符串 六.编辑程序 七.数据迁移 写在最后 # 写在前面 这几天,一直都在学习Entity Framework ...

  7. 接口例_龟车赛跑_Java

    此例演示java中接口的一般用法. 屋子里有一群程序员,每个人在写着自己的类,共同构建一个世界. 项目经理突然出现:“打扰大家一下,公司决定举办一个竞速比赛,你们写的类都可以参加.为了比赛的顺利进行, ...

  8. 超简单的VUE在线调试网站(不需搭建环境)

    jsbin.com提供简单.直观.易用的vue调试功能,最大的好处不需要自己搭建环境就可以学习VUE 1.打开http://jsbin.com/joxinumota/edit?html,js,cons ...

  9. Python进阶----多表查询(内连,左连,右连), 子查询(in,带比较运算符)

    Python进阶----多表查询(内连,左连,右连), 子查询(in,带比较运算符) 一丶多表查询     多表连接查询的应用场景: ​         连接是关系数据库模型的主要特点,也是区别于其他 ...

  10. 分布式事务:Saga模式

    1 Saga相关概念 1987年普林斯顿大学的Hector Garcia-Molina和Kenneth Salem发表了一篇Paper Sagas,讲述的是如何处理long lived transac ...