×

Spring Cloud 2022.0.0 Delivers Updates to Sub-Projects and JDK 17 Baseline

MMS Founder
MMS Johan Janssen

Article originally posted on InfoQ. Visit InfoQ

VMware has released Spring Cloud 2022.0.0, codenamed Kilburn, featuring updates to many of the Spring Cloud sub-projects. Built upon Spring Framework 6 and Spring Boot 3, introduced in November 2022, Spring Cloud is aligned with Java 17 and compatible with Jakarta EE 9. This release supports Ahead of Time (AOT) compilation and the creation native images with GraalVM.

Spring Cloud Commons now supports weighted load-balancing by configuring the property, spring.cloud.loadbalancer.configurations, as weighted. The OAuth integration now uses the new OAuth2 support from Spring Security.

Spring Cloud Gateway now supports Micrometer for observability as a replacement for Spring Cloud Sleuth. CORS may be disabled via the property, spring.cloud.gateway.globalcors.enabled, and may be configured per route as metadata with the cors key:

spring:
  cloud:
    gateway:
      routes:
      - id: myroute
        uri: https://www.infoq.com/
        predicates:
        - Path=/myroute/**
        metadata:
          cors
            allowedOrigins: '*'
            allowedMethods:
              - POST

Spring Cloud Kubernetes now supports fabric8 6.2.0 and version 17 of the Kubernetes Java Client. The Kubernetes specific annotation, @ConditionalOnKubernetesEnabled, has been replaced by the more generic @ConditionalOnCloudPlatform Spring Boot annotation. Name-based and labels-based secrets and configmaps are now read separately to prevent potential issues. Service discovery with the DiscoveryClient now supports filtering by namespace to prevent exceptions when trying to access restricted namespaces.

Spring Cloud Contract no longer supports Pact out of the box, as Pact, a tool for contract testing, broke the binary and functional compatibility, even with patch versions. The migration guide may be used to upgrade existing applications to the latest version of Spring Cloud Contract.

Spring Cloud OpenFeign is declared feature complete, which means no new features will be added, but security issues and bugs will be resolved and minor pull requests from the community will be considered. Spring Framework introduced the HTTP Interface in version 6.0, which will be used to replace OpenFeign.

Spring Cloud CLI, Spring Cloud Cloudfoundry and Spring Cloud Sleuth are no longer part of the release train.

Spring Cloud 2022.0.0 can be used after adding the following configuration to the Maven POM file:


    
        
            org.springframework.cloud
            spring-cloud-dependencies
            2022.0.0
            pom
            import
        
    


    
        org.springframework.cloud
        spring-cloud-starter-config
    
    
        org.springframework.cloud
        spring-cloud-starter-netflix-eureka-client
    

Alternatively, the following Gradle configuration may be used:

plugins {
  id 'java'
  id 'org.springframework.boot' version '3.0.0'
  id 'io.spring.dependency-management' version '1.1.0'
}
repositories {
  mavenCentral()
}
ext {
  set('springCloudVersion', "2022.0.0")
}
dependencies {
  implementation 'org.springframework.cloud:spring-cloud-starter-config'
  implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
}

dependencyManagement {
  imports {
    mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
  }
}

Breaking changes for this release may be found in the Release Notes and feedback may be provided via GitHub, Gitter, Stack Overflow or Twitter.

About the Author

Subscribe for MMS Newsletter

By signing up, you will receive updates about our latest information.

  • This field is for validation purposes and should be left unchanged.