首页 > 编程语言 > 详细

Spring Boot upgrade to 2.1.6 release

时间:2020-01-31 15:28:19      阅读:81      评论:0      收藏:0      [点我收藏+]

Process

To upgrade Spring Boot, you have to upgrade the tools and libs as well, including Gradle, Tomcat, Kafka, Redis, Zoomkeeper, Hanadb .etc

  • Find the dependency versions suit for your Spring Boot at here.
  • Do as the guideline said. 
  • Not only the Spring Boot migration guideline, but also the tools you will upgrade.

Problems happened and solutions

  • bootJar and jar: jar is default disabled and bootJar is default abled, if you are using project dependency(e.g. compile/implementation project(":projectname")), you need to care about this.
  • ConfigurationProperties: the prefix name must be lowercase, that means the first level of the profile‘s properties must be lowercase.
  • WARN Message for Implicit ‘open-in-view‘: a new feature that can avoid lazy loading exception from controller(web views), can disabled it by set

    spring.jpa.open-in-view: false

     

  • New id generator(sequence generator): SequenceStyleGenerator is default abled, you can disabled it by set 

    spring.jpa.hibernate.use-new-id-generator-mappings: false

    Or you can use replace the deprecated @SequenceGenerator, refer here .  

    This is a simple example: 

    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE,  generator="ID_SEQ")
    @GenericGenerator(name = "ID_SEQ",
        strategy = "org.hibernate.id.enhanced.SequenceStyleGenerator",
        parameters = {
            @Parameter(name = SEQUENCE_PARAM, value = "ID_SEQ")
        })
    private Long id;
  • Json date format: The date format which json returned has been changed form timestamps(createTime: 1544693261000) to UTC string("2018-12-13T09:27:41.000+0000") at Spring Boot2, you can use old format by set

    pring.jackson.serialization.write-dates-as-timestamps: true
  • Tomcat URI check: if you‘re using tomcat8 then no "_" is available for an URI.
  • Additional profiles for Spring Boot2: use spring.config.additional-location instead of spring.config.location.
  • Get rid of lightadmin:lightadmin is an inspect tool but intergrated with Spring Boot1.
  • Hana upgrade: have to add columnDefinition for tinyint clumns and set 0/1 to replace false/true.

Guidelines and useful links 

  • Springboot Migration Guides

v1.4 → v1.5

v1.5 → v2.0

Spring Boot upgrade to 2.1.6 release

原文:https://www.cnblogs.com/Lucifer-Jiang/p/12245281.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!