Spring Boot开发常见错误及解决办法

Failed to start component [Connector[HTTP/1.1-80]]::端口被占用,yml配置文件更改端口
3TGCQF25BLHU9R7IQUITN0FCC5
CLIENT_PLUGIN_AUTH is required] with root cause :MySQL版本问题,pom更改版本依赖
useUnicode=true&characterEncoding=utf-8 :设定时区时,serverTimezone=UTC比中国时间早8个小时,若在中国,可设置serverTimezone=Shanghai或者serverTimezone=Hongkong,例如:
driverClassName=com.mysql.cj.jdbc.Driver url=jdbc:mysql://localhost:3306/test?serverTimezone=Shanghai&?useUnicode=true&characterEncoding=utf8&useSSL=false username=root password=root

Error creating bean with name 'userController'启动类架包扫描@ComponentScan(basePackages = { "com.example.controller" }) Field userServiceImpl in com.hxz.controller.UserController required a bean of type 'com.hxz.service. @ComponentScan(basePackages = { "com.example.service.impl })

The Tomcat connector configured to listen on port 8081 failed to start. The port may already be in use or the connector may be misconfigured.: 更改端口号

错误: 找不到或无法加载主类 com.hxz.SpringBootBlogApplication :右击pom,选择maven clean再点击maven install
springboot 控制台debug sql : properties文件架logging.level.com.hxz.mapper=debug 其中logging.level.com.你的Mapper包=日志等级
attempted to return null from a method with a primitive return type (int). mapper文件返回值问题,注意是int还是String类型
Unable to infer base url. This is common when using dynamic servlet registration or when the API is .....(swagger错误)启动类加EnableSwagger2注解
springboot集成thymeleaf中遇到不能返回页面,只返回字符串。 原因:在controller中使用了注解@RestController修改:修改注解为@Controller
启动类异常:找不到启动类或者启动类main函数异常
往往是maven缓存问题,最有效的办法是删除,重新下载

.....\.m2\repository\org\springframework下的所有文件删除
重新下载,启动类不报错。其他的类似问题基本解决办法也是如此,比如我的依赖包拉下来了却发现仍然报classnotfoundexpextion的错误,删除即可!
发布了9 篇原创文章 · 获赞 73 · 访问量 8740

猜你喜欢

转载自blog.csdn.net/AAAhxz/article/details/103537146