SpringBoot
CommonDream
请相信,总有人跋山涉水为你而来。
展开
-
SpringBoot 项目处理前端传递的字符串日期 | SpringBoot-日期格式化 完美解决
一、问题描述 有时候我们需要前端来传递当前日期给后端,而后端则需要对前端传递过来的字符串日期格式或者时时间戳日期格式进行格式化操作。 二、解决方案 将我们的 XxController 类继承 DateController 工具类即可。 三、工具类 import org.apache.commons.lang3.time.DateUtils; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.原创 2022-05-26 22:42:01 · 2534 阅读 · 0 评论 -
.w.s.m.s.DefaultHandlerExceptionResolver 前端传递String类型的日期,后台报400错误-完美解决
一、问题描述 前端项目 Vue,后端项目 SpringBoot。前端传递字符串时间给后台,后台报错400。 二、解决方案 将我们的 Controller 继承该类即可完美解决!!! import org.apache.commons.lang3.time.DateUtils; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.InitBinder; i原创 2022-05-07 21:07:42 · 3069 阅读 · 0 评论 -
idea 错误: 在类 com.** 中找不到main方法,请将main方法定义为:public static void main(String[] args)否则 JavaFX 应用程序类
问题描述: 将项目重命名后,又修改了运行主类然后发现右上角项目运行报错了,然后强制运行项目就会报错提示: 错误: 在类 com.zmh.ZmhEduAdminApplication 中找不到 main 方法, 请将 main 方法定义为: public static void main(String[] args) 否则 JavaFX 应用程序类必须扩展javafx.application.Application 解决方法: 将项目根目录的 .idea 文件删除掉,然后重新导入项目即可完美解决。原创 2022-04-26 22:13:10 · 3603 阅读 · 0 评论 -
SpringBoot 时间差8小时&时分秒丢失问题
一、问题描述 数据表中生日字段类型为:datatime 在 SpringBoot 项目中查询出来发现只有年月日,时分秒丢失。 并且时区时间相差8小时。 解决方案一 在实体类的生日字段上加注解 @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 解决方案二 在 application.properties 配置文件中进行全局配置。 # 配置全局时间格式化 sprin原创 2022-04-14 19:53:42 · 1989 阅读 · 0 评论