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规范封装出来的一套持久层框架.该框架极大的降低了开发者工作量,提升开发效率.提供的关键字可 ...
随机推荐
- 为什么说要搞定微服务架构,先搞定RPC框架
今天开始聊一些微服务的实践,第一块,RPC框架的原理及实践,为什么说要搞定微服务架构,先搞定RPC框架呢? 一.需求缘起 服务化的一个好处就是,不限定服务的提供方使用什么技术选型,能够实现大公司跨团队 ...
- org.slf4j.helpers.Log4jLoggerFactory is not on classpath. Good!
View Javadoc 1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contrib ...
- 【转】spring的AOP原理,使用场景是什么?
什么是AOP AOP(Aspect-OrientedProgramming,面向方面编程),可以说是OOP(Object-Oriented Programing,面向对象编程)的补充和完善.OOP引入 ...
- Linux性能优化实战学习笔记:第四十九讲
一.上节回顾 上一期,我们一起梳理了,网络时不时丢包的分析定位和优化方法.先简单回顾一下.网络丢包,通常会带来严重的性能下降,特别是对 TCP 来说,丢包通常意味着网络拥塞和重传,进而会导致网络延迟增 ...
- java ++前缀
public class Sample { public static void main(String[] args) { , num2 = ; , num4 = ; ++num1; System. ...
- 检查hdfs块的块-fsck
hadoop集群运行过程中,上下节点是常有的事情,如果下架节点,hdfs存储的块肯定会受到影响. 如何查看当前的hdfs的块的状态 hadoop1.x时候的命令,hadoop2.x也可使用: hado ...
- Loj #2479. 「九省联考 2018」制胡窜
Loj #2479. 「九省联考 2018」制胡窜 题目描述 对于一个字符串 \(S\),我们定义 \(|S|\) 表示 \(S\) 的长度. 接着,我们定义 \(S_i\) 表示 \(S\) 中第 ...
- git 版本(commit) 回退 -- 使用git reset 指令
刚刚提交了三个commit, git reflog显示如下: 最后一个commit在文件末尾加了一行:v3,以此类推: 下面,使用git reset --hard commitID来进行commit回 ...
- java中的对象、类、包、模块、组件、容器、框架、架构的概念入门
在Java中有那么一些概念:对象.类.包.模块.组件.容器.框架.这些概念都有一个共同的特点,就是[容纳]. 对象(Object) 在Java的世界里,对象是通过属性和方法来分别对应事务所具有的静态属 ...
- Failed to instantiate [org.elasticsearch.client.transport.TransportClient]
Springboot 集成 ElasticSearch,springboot报错如下: Error starting ApplicationContext. To display the auto-c ...