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没写全导致的 正确应该写成这样就可以了:
随机推荐
- linux下使用lftp的小结
今天在解决一个远程服务器备份的问题时,用到了lftp的相关知识.整理如下: lftp的功能比较强大,相比原来用ftp,方便了很多. 1.登陆: lftp ftp://yourname@site pwd ...
- 【GDAL】GDAL栅格数据结构学习笔记(一): 关于Metadata
在维护一段代码时看到前任程序员写的获取栅格数据的CellSize的功能,竟然在知道GDAL的情况下去调用AE的接口来解算,觉得费解. 原来的思路是使用AE的Raster对象读取出Raster的文件大小 ...
- Php 单元测试 phpunit && codecept
Php 单元测试 phpunit && codecept phpunit: Windows版本 整体上说,在 Windows 下安装 PHAR 和手工在 Windows 下安装 Com ...
- USACO 6.4 章节
The Primes 题目大意 5*5矩阵,给定左上角 要所有行,列,从左向右看对角线为质数,没有前导零,且这些质数数位和相等(题目给和) 按字典序输出所有方案... 题解 看上去就是个 无脑暴搜 题 ...
- python 装饰器 第六步:带有收集参数的函数的装饰器
#第六步:带有收集参数的函数的装饰器 #装饰器函数 def kuozhan(func): #内部函数(扩展之后的eat函数) def neweat(*w,**n): #以下三步就是扩展之后的功能,于是 ...
- Springboot集成Mybatis+PageHelper
1.Springboot项目引入mysql和mybatis的依赖: <dependency> <groupId>org.mybatis.spring.boot</grou ...
- 属性选择器 [attribute^=value] [attribute~=value] [attribute|=value] [attribute*=value]
这是css属性选择器的一种:[attribute^=value] ,用来匹配属性值以指定值开头的每个元素.例如: [class^="test"] { background:#fff ...
- C++继承中的构造和析构
1,构造:对象在创建的后所要做的一系列初始化的工作: 析构:对象在摧毁之前所要做的一系列清理工作: 2,思考: 1,子类中如何初始化父类成员? 1,对于继承而言,子类可以获得父类的代码,可以获得父类中 ...
- Codeforces 488D Strip (set+DP)
D. Strip time limit per test 1 second memory limit per test 256 megabytes input standard input outpu ...
- C#base使用笔记
一,base继承使用 using System; using System.Collections.Generic; using System.Linq; using System.Text; nam ...