spring
harryperlau
软件工程在读。
展开
-
【spring-boot脱坑指南】增强for循环遍历同类型时报错 java.lang.ClassCastException
private Set<QaSysUserDto.UserRights> getRightsByGroups(Set<QaSysUserGroupDto> qaSysUserGroup) throws QaGroupException{ //遍历角色,把拥有的权限集中起来 for(QaSysUserGroupDto userGroup : qaSysUserGro...原创 2019-12-24 10:50:54 · 1008 阅读 · 3 评论 -
spring4.x不再提供 HibernateTemplate.saveOrUpdateAll(Collection<T>) 的支持
最近要把项目从spring 3.x 转到 4.x,虽然很多原来的代码都可使用,但如果新版本能兼容你的老项目,那官方的更新就没意义了(逃。。。报错: The method saveOrUpdateAll(Collection<T>) is undefined for the type HibernateTemplate原因:如果你观看spring2<API FOR S...原创 2018-04-10 17:36:00 · 1854 阅读 · 0 评论 -
spring data jpa 之 JpaRepository
目前对JpaRepository的了解不足以总结成一篇博文,先做一点总结: 1,继承体系如下 2,spring 会为任何继承 Repository 的接口生成一个实现类;3,可以根据 spring 的规范,findBy + “属性名”生成自定义的方法; 都需要以findBy开头,且方法中的字段名必须与实体类中的属性名一致,并遵循驼峰式代码编写风格And:等价于SQ...原创 2018-04-24 17:18:18 · 697 阅读 · 0 评论 -
实体类属性配置错误导致springboot启动报错
错误类型:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/Hibe...原创 2018-12-05 10:44:22 · 1124 阅读 · 0 评论 -
【spring-boot脱坑指南】@ConfigurationProperties 取消 locations 属性
Spring Boot 1.4之后取消了 ConfigurationProperties 的 locations 属性,无法指定属性资源的位置。两种替代方案第一种:使用 @Component 注册为组件,然后使用 @PropertySource 指定资源位置。@Component@ConfigurationProperties(prefix = "book")@PropertySou...原创 2019-07-08 15:46:06 · 469 阅读 · 1 评论