Spring Boot 报错记录
Spring Boot 报错记录
由于新建的项目没有配置数据库连接启动报错,可以通过取消自动数据源自动配置来解决
解决方案1:
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
//@SpringBootApplication
@MapperScan("com.example.*") //扫描:该包下相应的class,主要是MyBatis的持久化类.
解决方案2:
#去配置文件中配置数据库连接参数
########################################################
###datasource -- mysql\u7684\u6570\u636e\u5e93\u914d\u7f6e.
########################################################
spring.datasource.url = jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8
spring.datasource.username = root
spring.datasource.password = root
spring.datasource.driverClassName = com.mysql.jdbc.Driver
spring.datasource.max-active=20
spring.datasource.max-idle=8
spring.datasource.min-idle=8
spring.datasource.initial-size=10
热启动占用端口报错
解决方案1:
#在配置文件中修改端口号
server.port=8888
解决方案2:
选择另外一种热启动方式,或者关闭端口
扫描包的注解 @MapperScan 和 @ComponentScan 的区别
首先,@ComponentScan是组件扫描注解,用来扫描@Controller @Service @Repository这类,主要就是定义扫描的路径从中找出标志了需要装配的类到Spring容器中
其次,@MapperScan 是扫描mapper类的注解,就不用在每个mapper类上加@MapperScan了
这两个注解是可以同时使用的。@SpringBootApplication
//扫描:该包下相应的class,主要是MyBatis的持久化类.
@MapperScan("com.example.mapper")
//扫描controller、service等
@ComponentScan(basePackages = { "com.example.controller", "com.example.service"})
Spring Boot 报错记录的更多相关文章
- Spring Boot报错 MultipartException The temporary upload...
Spring Boot报错:尤其是在处理Ribbon这类接口调用型的负载均衡组件,常见问题 ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.se ...
- 初学 Spring boot 报错 Whitelabel Error Page 404
按照教程,写了个最简单的 HelloWorld,尼玛报错 -->Whitelabel Error Page 404. 网上99%都是项目结构不对,说什么 Application放在父级 pack ...
- 启动Spring boot报错:nested exception is java.sql.SQLException: Field 'id' doesn't have a default value
先看具体日志: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with n ...
- spring boot 报错 Failed to read HTTP message
2008-12-13 15:06:03,930 WARN (DefaultHandlerExceptionResolver.java:384)- Failed to read HTTP message ...
- Spring Boot 报错:Error creating bean with name 'entityManagerFactory' defined in class path resource
spring boot 写一个web项目,在使用spring-data-jpa的时候,启动报如下错误: Error starting ApplicationContext. To display th ...
- Spring boot 报错 Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
在实际开发中修改别人的代码,发现了这个报错,后来发现是因为pom.xml里面 只要将注释掉的部分注释掉就好了.
- spring boot 报错 Error creating bean with name
Application 启动类 要和父目录平级
- spring boot 报错
错误1: 循环 的 请求. ..例如 cirle..url 在返回的模板路径上 加速 "/" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 错误2 : 添加了sh ...
- spring boot报错:Invalid bound statement (not found): com.
经检查发现mapper的namespace没写全导致的 正确应该写成这样就可以了:
随机推荐
- jmeter_使用命令行运行
使用非GUI模式,即命令行模式运行 JMeter 测试脚本能够大大缩减所需要的系统资源. Windows下以命令行模式运行的方法: 1.命令介绍 jmeter -n -t <testfile f ...
- fat32转ntfs ,Win7系统提示对于目标文件系统文件过大解决教程
系统之家 发布时间:18-05-3117:56 很多Win7用户在复制较大的文件时,系统会弹出窗口提示“对于目标文件系统,文件XXX过大”,出现这种情况的原因是FAT32的文件系统不支持复制大于4g的 ...
- 抓包工具fiddler下载配置(三):手机设置代理
前言 本篇仅讲解了手机端如何设置代理,是[抓包工具fiddler下载配置(一):下载/安装&信任证书]的后续文章,未下载安装抓包工具的需先参考文章[抓包工具fiddler下载配置(一):下 ...
- Ubuntu添加字体
在字体库下载打包好的字体: 方正字体全库:http://www.downza.cn/soft/8203.html 华文字体:http://www.onlinedown.net/soft/635126. ...
- Codeforces 488D Strip (set+DP)
D. Strip time limit per test 1 second memory limit per test 256 megabytes input standard input outpu ...
- Java-技术专区-如何监控Java线程池的状态
线程池介绍 什么是线程池.线程池核心类.线程池工作流程.线程池分类.拒绝策略.及如何提交与关闭线程池等. 但在实际开发过程中,在线程池使用过程中可能会遇到各方面的故障,如线程池阻塞,无法提交新任务等. ...
- K8S入门系列之必备扩展组件--> coredns(四)
摘要: 集群其他组件全部完成后我们应当部署集群 DNS 使 service 等能够正常解析,1.11版本coredns已经取代kube-dns成为集群默认dns. https://github.com ...
- Python之字符串转换为日期、结合时区的日期操作
一.字符串转换为日期 方法一 s = '2019-01-20' print(datetime.strptime(s, '%Y-%m-%d')) # 2019-01-20 00:00:00 方法二 de ...
- 向服务器发送post请求
/** * 通过HttpClient发送Post请求 * @param path 请求路径 * @param params 请求参数 * @param encoding 编码 * @return 请求 ...
- js运算符的优先级的顺序列表
优先级权重 运算符 17 ..[].new 16 () 15 ++.-- 14 !.~.+(单目).-(单目).typeof.void.delete 13 %.*./ 12 +(双目).-(双目) 1 ...