springboot 2.0.2升级到springboot 2.6.7问题记录

springboot 2.0.2升级到springboot 2.6.7问题记录,第1张

我用的springboot+jpa+thymeleaf

1. BaseRepositoryFactory的getTargetRepository变了

原来的

@Override 
protected Object getTargetRepository(RepositoryInformation information) { 
    return new BaseJpaRepository((Class)information.getDomainType(), em);
}

改为:

 @Override
 protected JpaRepositoryImplementation getTargetRepository(RepositoryInformation information,EntityManager entityManager) {
    JpaEntityInformation entityInformation = this.getEntityInformation(information.getDomainType());
    Object repository = this.getTargetRepositoryViaReflection(information, new Object[]{entityInformation, entityManager});
    Assert.isInstanceOf(BaseJpaRepository.class, repository);
    return (JpaRepositoryImplementation)repository;
}

2. 查询的排序变了

Sort sort = new Sort(Direction.ASC, "字段");

改为:

Sort sort = Sort.by(Sort.Direction.ASC, "字段");

3. thymeleaf的引用模板页不起作用了。所有页面都乱了。

引用模板的部分layout:decorator改成使用新的标签 layout:decorate 进行页面布局。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/756716.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-04-30
下一篇2022-04-30

发表评论

登录后才能评论

评论列表(0条)

    保存