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