SpringBoot——报错总结
前言
记录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——报错总结的更多相关文章
- SpringBoot报错:Failed to load ApplicationContext(javax.websocket.server.ServerContainer not available)
引起条件: WebSocket+单元测试,单元测试报错! 解决方法: SpringBootTest增加webEnvironment参数. https://docs.spring.io/spring-b ...
- SpringBoot报错:java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String;
错误:java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String ...
- springboot报错Whitelabel Error Page
第一次使用springboot没有问题.隔了两天继续看.一直报错Whitelabel Error Page. 重新搭建试了任何方法都错了. 报的就是一个404错误,犯了一个习惯性错误,一般都是loca ...
- springboot报错Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean
springboot项目在启动时需要把servlet容器编译进去,这时候如果你的maven依赖里面没有配置jetty或者tomcat相关依赖就会报错. 解决方法: jetty添加 <depend ...
- SpringBoot报错笔记
异常一: 1.访问所有方法路径都返回一个page: 截图: 出错原因:不知道 解决方法:新建项目 异常二: 提交表单信息报错 原因:映射文件和和表单的提交方式不统一 解决方法:统一方式即可: 错误三: ...
- 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 ...
- springboot 报错 Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported
开始 controller 方法写的是 @RequestMapping( value = "/add", method = RequestMethod.POST ) public ...
- springboot 报错 org.springframework.beans.factory.NoSuchBeanDefinitionException:No qualifying bean of type 'com.example.service.HrService' available: 有没有大佬出个主意,我找了一天,刚入门springboot
话不多说先上图,这是启动类的配置,这里配置了@ComponentScan("我的mapper的接口") 接下来是我的项目结构截图 然后是service 的截图,我在这里加了注解@S ...
- SpringBoot 报错: Circular view path [readingList] 解决办法
spring boot报错: Circular view path [readingList]: would dispatch back to the current handler URL [/re ...
随机推荐
- 【RS】:论文《Neural Collaborative Filtering》的思路及模型框架
[论文的思路] NCF 框架如上: 1.输入层:首先将输入的user.item表示为二值化的稀疏向量(用one-hot encoding) 2.嵌入层(embedding):将稀疏表示映射为稠密向量( ...
- mysql5.7报错ERROR 1819解决办法
MySQL5.6.6版本之后增加了密码强度验证插件validate_password,相关参数设置的较为严格. 使用了该插件会检查设置的密码是否符合当前设置的强度规则,若不满足则拒绝设置.影响的语句和 ...
- ReentrantReadWriteLock源码
@SuppressWarnings("restriction") public class ReentrantReadWriteLock1 implements ReadWrite ...
- 用shell脚本批量进行xss跨站攻击请求
由于执行的xss攻击请求他多了,初步估计要执行83次,而且还要执行3篇,如果手工一个一个去执行,说出去,我还配叫自动化大师吗: 有鉴于此,边打算自己编写一个脚本进行批量执行: 而短脚本的编写,非she ...
- eclipse从svn检出maven项目
使用Eclipse从svn检出项目. 打开Eclipse,在project explorer空白区域右键鼠标移至import选择import. 2 之后选择svn-->从svn检出项目,然后输入 ...
- Jwt身份验证
转载自博友(TerryTon) 1.因为json是通用的,所以jwt可以在绝大部分平台可以通用,如java,python,php,.net等 2.基于jwt是无状态的,jwt可以用于分布式等现在比 ...
- jsGrid使用入门
jsGrid使用入门 原创蓝天上的一朵云 本文链接:https://blog.csdn.net/u012846041/article/details/82735811 jsGrid资源地址: http ...
- tf.assign_add
import tensorflow as tf global_step = tf.Variable(1.0, dtype=tf.float64, trainable=False, name='glob ...
- Spring Boot 框架下使用MyBatis访问数据库之基于XML配置的方式
MyBatis 是一款优秀的持久层框架,它支持定制化 SQL.存储过程以及高级映射.MyBatis 避免了几乎所有的 JDBC 代码和手动设置参数以及获取结果集.MyBatis 可以使用简单的 XML ...
- php批量检查https证书有效期
function get_cert_info($domain){ $context = stream_context_create(['ssl' => [ 'capture_peer_cert' ...