springboot 找不到mapper_idea创建springboot中所遇到的坑?你遇到了这些了吗?

推荐学习

  • 最全SpringBoot学习教程,GitHub上20K+star,帮你解决95%的问题
  • Spring全家桶笔记:Spring+Spring Boot+Spring Cloud+Spring MVC

创建springboot项目使用的是MAVEN模式

问题一、每次创建都会自动下载maven所需的依赖包

解决方法: file–》other settings–》settings for new project

98f1b074c999724233dff732a1935e22.png

Maven home directory: 你的maven安装位置

User settings file: maven 安装位置的conf – settings文件位置

Local repository: 中央仓库存储的你所需要的jar包文件

勾选完之后,再创建springboot就不会重新下载Maven了,他只会加载 你本地没有的jar文件

问题二、The server time zone value ‘�й���׼ʱ��’ is unrecognized or represents more than one time zone.

解决方法:

1、在资源配置文件中,修改url spring.datasource.url=jdbc:mysql://localhost:3306/trainning?characterEncoding=utf-8&&serverTimezone=UTC

server.port = 8889spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driverspring.datasource.url=jdbc:mysql://localhost:3306/trainning?characterEncoding=utf-8&&serverTimezone=UTCspring.datasource.username=rootspring.datasource.password=xxxxxmybatis.mapper-locations=classpath:mapper/*.xml

问题三、springboot+freemaker综合的坑

一、无妨访问

Whitelabel Error PageThis application has no explicit mapping for /error, so you are seeing this as a fallback.Wed Apr 29 21:30:08 CST 2020There was an unexpected error (type=Not Found, status=404).No message available

解决方法:

查看pom文件中的依赖

org.springframework.boot            spring-boot-starter-freemarker

二、templates文件夹下无法创建***.ftl文件

操作步骤:1、file–settings–file type

e3bf16324810f76238c3c09771521b68.png

添加一个*.ftl**的文件格式

问题四、端口号被占用访问不到的问题(Failed to start component [Connector[HTTP/1.1-8880]])

解决方法:

  • 打开dos命令窗口(快捷键windows+r)输入cmd
  • 查找已开启的端口号:netstat -ano
f74dd468c8cd6d83ebb903faf62f9e07.png

之后打开任务管理器,选择详细信息,根据dos窗口的端口号对应的pid找到任务管理器的pid然后将其关闭。问题解决

问题五、通过maven的package命令导出的jar包,无法读取(Unable to access jarfile xxx.jar)

解决方法:

  • 1、可能是路径的问题,换成绝对路径试一下。
  • 2、配置文件的问题,可以看看自己的配置文件,一定要修改成自己的不要方便,直接copy,会出现问题的

问题六、To display the conditions report re-run your application with ‘debug’ enabled.

Description:A component required a bean of type 'com.project01.project01.dao.UserDao' that could not be found.Action:Consider defining a bean of type 'com.project01.project01.dao.UserDao' in your configuration.

扫描的时候找不到userdao的接口

解决方法:

  • 方法1、注释掉pom中多余的依赖
  • 方法2、在userdao的接口加一个注解@Mapper

如图所示:

0e67cf263c8e1bc97622e8222531bc68.png

就可以解决这个问题

总结:入坑不断问题不断,在这里找到你的解决方法,是我的一大满足

作者:敲出亿行bug

原文链接:https://blog.csdn.net/wenquan19960602/article/details/105831419

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值