springboot日常问题处理手记
springboot启动问题
1.@Autowired报错Could not autowire. No beans of xxx
解决:只需在DAO接口加上@Component 或者 @Repository
参考:https://blog.csdn.net/Mr_EvanChen/article/details/84035445
2.Consider defining a bean of type ‘XXX’ in your configuration.
解决:在启动类上加上@MapperScan或者@ComponentScan注解,手动指定application类要扫描哪些包下的注解,如下所示:
@SpringBootApplication
@ComponentScan(basePackages = {"com.xxx.xxx.dao"})
参考:https://www.cnblogs.com/nananana/p/9333917.html
https://blog.csdn.net/suxiexingchen/article/details/84984349
3.Failed to configure a DataSource: 'url' attribute is not specified and no embedd
问题:应用中没有配置datasource的一些相关属性,例如:地址值啊,数据库驱动啊,用户名啊,密码啊
解决:application.properties文件中加spring.datasource相关配置
参考:https://blog.csdn.net/qq_40223688/article/details/88191732
4.org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException
问题:之前生成了引起异常的队列,一启动就报错
解决:浏览器打开http://192.168.0.100:15672/#/把之前相关的队列删除,再次启动不报错了
参考:https://www.cnblogs.com/javawxid/p/10855071.html
5.Exception in thread "main" java.lang.NoSuchMethodError: freemarker.template.Configuration.
定位是freemarker版本问题:
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.20</version>
</dependency>
改为:
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.28</version>
</dependency>
就正常了
springboot运行中问题
1.mybatis-plus驼峰下划线转换问题
设置不用其下划线命名法,在MybatisPlusConfig.java中设置
MybatisSqlSessionFactoryBean mybatisPlus = new MybatisSqlSessionFactoryBean();
mybatisPlus.setDbColumnUnderline(true);
也可以在application.yml配置
mybatis-plus:
global-config:
#驼峰下划线转换
db-column-underline: true
springboot日常问题处理手记的更多相关文章
- 【日常错误】spring-boot配置文件读取不到
最近在用spring-boot做项目时,遇到自定义的配置文件无法读取到的问题,通过在appcation.java类上定义@PropertySource(value = {"classpath ...
- Java SpringBoot 手记
SpringBoot Git:https://github.com/spring-projects/spring-boot Maven (mvn)环境配置: 下载地址:http://maven.apa ...
- [转]mysql日常工作手记
1. 给navy加show权限: 1 2 update mysql.user set Show_db_priv='Y' where user='navy'; flush privileges; 2. ...
- springboot常用方法手记
1.Map方法 获取map的key和value的方法 Map<String, Object> map = new HashMap<>(); map.put("mobi ...
- 关于《Linux.NET学习手记(8)》的补充说明
早前的一两天<Linux.NET学习手记(8)>发布了,这一篇主要是讲述OWIN框架与OwinHost之间如何根据OWIN协议进行通信构成一套完整的系统.文中我们还直接学习如何直接操作OW ...
- [小北De编程手记] : Lesson 08 - Selenium For C# 之 PageFactory & 团队构建
本文想跟大家分享的是Selenium对PageObject模式的支持和自动化测试团队的构建.<Selenium For C#>系列的文章写到这里已经接近尾声了,如果之前的文章你是一篇篇的读 ...
- springboot 入门二- 读取配置信息一
在上篇入门中简单介绍下springboot启动使用了大量的默认配置,在实际开发过程中,经常需要启动多个服务,那端口如何手动修改呢? 此篇就是简单介绍相关的配置文件信息. Spring Boot允许外部 ...
- SpringBoot入门:Spring Data JPA 和 JPA(理论)
参考链接: Spring Data JPA - Reference Documentation Spring Data JPA--参考文档 中文版 纯洁的微笑:http://www.ityouknow ...
- springboot集成jpa
spring data jpa简介 spring data jpa是spring基于hibernate及jpa规范封装出来的一套持久层框架.该框架极大的降低了开发者工作量,提升开发效率.提供的关键字可 ...
随机推荐
- React组件简单介绍
组件是 React 的核心,因此了解如何利用它们对于创建优秀的设计结构至关重要. 组件之间传递信息方式: 1.(父组件)向(子组件)传递信息 2.(子组件)向(父组件)传递信息 3.没有任何嵌套关系的 ...
- wal2json docker 试用
基于官方的release 构建了一个docker 镜像,以下是测试使用 环境准备 docker-compose 文件 version: "3" services: mypg: ...
- bootstrap-table 列拖动
1.页面js/css <!-- bootstrap 插件样式 --> <link th:href="@{/common/bootstrap-3.3.6/css/bootst ...
- [LeetCode] 301. Remove Invalid Parentheses 移除非法括号
Remove the minimum number of invalid parentheses in order to make the input string valid. Return all ...
- [LeetCode] 208. Implement Trie (Prefix Tree) 实现字典树(前缀树)
Implement a trie with insert, search, and startsWith methods. Example: Trie trie = new Trie(); trie. ...
- 什么是默认登录shell,如何改变指定用户的登录shell?
在Linux操作系统,“/bin/bash”是默认登录shell,是在创建用户时分配的.使用chsh命令可以改变默认的shell.示例如下所示: #chsh <username> -s & ...
- 热情组——项目冲刺 Day2
项目相关 作业相关 具体描述 班级 班级链接 作业要求 链接地址 团队名称 热情组 作业目标 实现软件的生成,以及在福大的传播 Github链接 链接地址 SCRUM部分: 成员昵称 昨日目标 开始时 ...
- 全局安装npm包报错没有权限
背景:npm i npm-check -g 时报错没有权限 Error: EACCES: permission denied, access '/usr/local/lib/node_modules' ...
- sprintboot+mybatis+@Mapper中in的使用方法
错误的使用方法: @Select("select goods_sn from ${tableName} where goods_sn in (#{skuStr})") public ...
- javascript的对象与字符串相互转换
因为对象不利于网络传输,因此要转换成字符串,转换成字符串之后又要考虑怎么将这个字符串转换回对象,以便取得对象中的属性. 常用的做法是将对象转换为JSON字符串,这里的转换方法也是用的JSON官方提供的 ...