- 博客(14)
- 收藏
- 关注
原创 SpringBoot配置文件加载顺序
当存在application.yml和application.properties配置文件时,如果存在相同配置项,那么application.properties会覆盖application.yml。6.jar包外部的application-{profile}.properties或application.yml(带spring.profile)配置文件。8.jar包外部的application.properties或application.yml(不带spring.profile)配置文件。
2025-10-17 16:11:53
271
原创 @RequiredArgsConstructor使用
在写具体逻辑时候,比如service层,我们可能需要注入很多的repository或者mapper接口,用注解@Autowired的话,每个都需要加注解,除此外还有一些缺点。在现代Spring(特别是Spring 4.3及以上版本)中,官方推荐使用基于构造器的注入,这种方式也使得代码冗长。lombok提供了一个注解: @RequiredArgsConstructor(基于构造器注入)并且,在这个生成的构造函数上,加上 @Autowired 注解。这样一个注解就替代了多个字段的构造函数声明,非常干净。
2025-10-11 10:20:20
141
原创 java.lang.IllegalArgumentException: invalid comparison: java.util.Date and java.lang.String
原因:对于时间参数进行比较时, 如果拿传入的时间类型参数与空字符串"''进行对比判断,则会报错。修改:只比较是否为null就好了。
2025-03-21 14:22:15
242
原创 io.seata.common.exception.ShouldNeverHappenException: Could not found any index in the table
报错:io.seata.common.exception.ShouldNeverHappenException: Could not found any index in the table。原因:缺少主键或唯一索引,Seata 需要一个主键或唯一索引来确保数据的一致性和唯一性。同时也就有了主键索引通过sql语句可以查到。解决方法:检查并添加主键或唯一索引。
2025-01-08 15:49:10
429
1
原创 IDEA快捷键生成serialVersionUID
2、打开Settings->Editor->Inspections->Java->JVM languages里找到,勾选然后应用即可。或者直接搜索serializable class without ‘serialVersionUID’也。可以找到,勾选然后应用即可。3.然后鼠标放在类名上,AIt+Enter即可。1、首先类要实现Serializable接口。
2024-05-10 10:41:03
1503
1
原创 新建一个springboot项目报错
错误的类文件: /D:/Repository/org/springframework/boot/spring-boot/3.0.5/spring-boot-3.0.5.jar!/org/springframework/boot/SpringApplication.class 类文件具有错误的版本 61.0, 应为 52.0。2.IDEA形式,勾选"Always update snapshots",然后再用Maven / Reimport来更新依赖。
2023-08-10 14:41:30
1514
1
原创 Failed to convert value of type ‘java.lang.String‘ to required type ‘java.lang.Long‘; nested excepti
Failed to convert value of type 'java.lang.String' to required type 'java.lang.Long'; nested exception is java.lang.NumberFormatException: For input string: "export-order"
2023-05-21 16:52:36
1910
1
原创 These dependencies were not found: swiper/swiper-bundle.css
These dependencies were not found:swiper/swiper-bundle.css
2023-02-01 14:56:22
2370
原创 MySQL报错:Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘xx
MySQL报错“Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggre”解决方法
2022-11-25 11:08:38
763
原创 com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
**com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
2022-09-07 20:47:26
821
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅