top of page

SpringBoot 3.0 features

  • Writer: Anand Nerurkar
    Anand Nerurkar
  • Nov 3, 2023
  • 3 min read

Updated: May 27, 2024


ree
  1. Java 17 as baseline for long term support

  2. Jakarta EE support with servlet 5.0 and JPA 3.0 specification. Javax package is now migrated to Jakarta EE, so we need to import those packages accordingly

  3. SpringNative support with Gral VM to compile spring application into local executable image file, reduces memory footprint ,improve the start up time to boot

  4. Observability support- can publish metrices to grafna or any other platform

  5. ProblemDetail-With ProblemDetails we can map http specific error in application

  6. dependcny upgrade - Java 17 support minimum, lombok 1.18 onward,gradle 7.3 onward

  7. HttpExchange --declarative way of defining rest client, need spring reactive web in pom.xml

  8. Spring Framework 6.0 support


AsJava 17 feature, we can make use of record classes instead of DTO classes as below


ree

record is by default final,all varibale are private ,final. it is immutable and provide thread safty. it does not have setter and getter and can not define it also. with filed name only we get method to access that field. It simply servee the purpose of data carrier as DTO.


ProblemDetail--


Noramlly we create Error class with various attribute like error code,status code,message and then make use of this class as part of exception handling. From Java17 onward, this funcationality is now supported by ProbelmDetail.


Please see code snippet for reference.


ree

problemdetail have below api.

ree

Observability


With observability , we can publish metrcies for application in spring cloud infrastructure with zipkin and sleuth. It can also be published and visualized with grafana.


Below package we need to use for the observability support


ree

code snipet

==

Here we are monitoring all api operation of rest endpoint


metrcis name - addCustomer ---for addcustomer endpoint

getCustomer-----for getCustomer endpoint


we are making use of observation registry to monitor metrcies and publish it to macrometer so that it can be used by 3rd party tool like promotheus,grafana

ree

once we successfully test our endpoint , we can track our metrcies on actuator/metrcies as below and can see our metrices


ree

ree

@HttpExchange

==

Declarative way of defining rest client for consuming rest api endpoint


we need to consume below api endpoint


ree

endpoint - /customerinfo

method-- GET

return type -- list of customer


will define client package and in that we will define interface to comsume api asbelow


ree

depending on type of methos , we can have below HttpExchange

ree

to consume api endpoint, we will make use of below


ree

now we can not create instance of interface, we need to have bean of webclient and register this interface with it so that spi can be consumed




ree

register cusotmerclientservice with httpserviceproxyfactory as below

ree


ree

Springboot 3.1.1 migration

====


update springboot version from 2.7.3 to 3.1.1

update java version to 17

update cloud version


please note that for every project, just create same project in spring initializer with same dependency as we have for our existing project, this will give any

dependency need to be updated or any version or name for the dependency to be updated


for example:

zipkin , sleuth is now replaced by micrometer brave and zipkin reporter, okta is now being revised to new version


so those above changes we need to make for our migration, elaode maven project, all latest jar will be downloaded, start project


we may find compile time error for javax package as it is moved to Jakarta, so change import for Jakarta


sping6 has deprecated antMatvher , it is now requestMatcher, just use this.

replace @EnableEurekaClient with EurekaDiscoveryClient



 
 
 

Recent Posts

See All
VP-OKR-KPI-

VP Technology / Architecture – Strategic Framework 1️⃣ Strategic (12–36 months) Focus: Long-term business and technology transformation Objectives / Goals: Cloud-First & API-First:  Modernize platform

 
 
 
Grounded Context & Citation

is citation & grounded context is same?? ===== Good question — they’re related but not the same , and interviewers often use them loosely, which causes confusion. Short answer ❌ Citation ≠ Grounded Co

 
 
 

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
  • Facebook
  • Twitter
  • LinkedIn

©2024 by AeeroTech. Proudly created with Wix.com

bottom of page