随笔分类 -  Spring

摘要:1、requestParam参数校验 描述:通常用于get请求或者请求参数比较少的情形。 校验生效的前提:必须在Controller类上标注@Validated注解,在方法或者参数前添加无效! 如果校验失败,会抛出ConstraintViolationException异常。 @GetMapping 阅读全文
posted @ 2023-11-06 16:43 唏嘘- 阅读(2074) 评论(0) 推荐(0) 编辑
摘要:1、单独处理: springboot默认提供,在需要的字段上使用 @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") private Date createDate; @JsonFormat( 阅读全文
posted @ 2023-06-06 14:06 唏嘘- 阅读(512) 评论(0) 推荐(0) 编辑
摘要:获取代理对象的方法: AopContext.currentProxy(); 在同一个类中,非事务方法A()调用事务方法B(),事务失效, 得采用((xxxObj)AopContext.currentProxy()).B()来进行调用,事务才能生效。 B方法被A调用,对B方法的切入失效,但加上AopC 阅读全文
posted @ 2023-05-29 14:51 唏嘘- 阅读(309) 评论(0) 推荐(0) 编辑
摘要:spring 1.x 版本及以前版本 server.context-path=/test spring 2.x 版本及以后版本 server.servlet.context-path=/test 阅读全文
posted @ 2023-02-16 16:02 唏嘘- 阅读(744) 评论(0) 推荐(0) 编辑
摘要:报错日志: Description: The dependencies of some of the beans in the application context form a cycle: personController (field com.example.wongz.service.Us 阅读全文
posted @ 2022-12-02 15:32 唏嘘- 阅读(1053) 评论(0) 推荐(0) 编辑
摘要:在配置类中没有加上 @Configuration 导致@Bean之间不能相互调用 阅读全文
posted @ 2022-12-01 16:01 唏嘘- 阅读(625) 评论(1) 推荐(1) 编辑
摘要:1、局部处理 (1)在相应字段上加@JsonFormat @JsonFormat(shape = JsonFormat.Shape.STRING)(2)在相应字段上加@JsonSerialize@JsonSerialize(using= ToStringSerializer.class) 2、全局处 阅读全文
posted @ 2022-09-07 16:24 唏嘘- 阅读(1798) 评论(0) 推荐(0) 编辑
摘要:spring 整合 mybatis 报错日志 Exception in thread "main" org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.Persiste 阅读全文
posted @ 2021-10-10 08:27 唏嘘- 阅读(1131) 评论(0) 推荐(0) 编辑
摘要:spring 整合 mybatis 报错信息 Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.mybatis.spring.SqlSessio 阅读全文
posted @ 2021-10-10 08:18 唏嘘- 阅读(857) 评论(0) 推荐(0) 编辑
摘要:spring 整合 mybatis 报错信息 java.lang.NoClassDefFoundError: org/apache/commons/pool/KeyedObjectPoolFactory 找不到commons-pool, 添加commons-pool-1.6依赖 <dependenc 阅读全文
posted @ 2021-10-10 08:14 唏嘘- 阅读(177) 评论(0) 推荐(0) 编辑
摘要:spring 整合 mybatis 查询数据库报错 java.lang.NoClassDefFoundError: org/springframework/dao/support/DaoSupport 缺少jar包 添加如下jar包 <dependency> <groupId>org.springf 阅读全文
posted @ 2021-10-10 08:11 唏嘘- 阅读(902) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示