Upgrading Angular & Spring Boot Versions

Diksha Pathak
3 min readApr 9, 2023

--

Here, the focus is on upgrading Angular 13 to Angular 15, Nodejs 14 to Nodejs18, Spring Boot 2.x to Spring Boot 3 along with Java 11 to Java 17. I will also discuss some errors that I encountered while performing this upgrade. This blog will assume that you’re already using Java 11,springboot 2.x, Angular 13 or higher and Nodejs 14.

In software development, technology versions that we use keep on reaching end of life with their new releases taking their place. I have recently worked on upgrading Angular & Spring boot versions and will touch base the steps that I followed and a few things to keep in mind.

Nodejs 14 to Nodejs 18

  1. Install Nodejs 18 in your system and delete older version of Nodejs from your system.
  2. Import the settings into your IDE.
  3. Open your IDE and go to settings. In your Languages & framework, select the latest version of node to use as node interpreter and package manager.
  4. Update your yaml files if there is a mention of Nodejs.
  5. Delete package-lock.json file and run npm install. New package-lock.json will be auto-generated.
  6. Run all your unit test cases once to see if no test case fails because of the upgrade.

Angular 13 to Angular 15

Firstly, you can not directly upgrade Angular 13 to 15, first you’ll need to upgrade Angular 13 to 14 and then to 15. Secondly, there are 2 ways to perform this upgrade and we will see both ways — Manual and using ng update.

Manual Upgrade

  1. Manually update package.json to versions of Angular 14. Delete old package-lock.json and run npm install.
  2. Do the same for upgrading to Angular 15.

Checkpoint : If you’re using NGCC, make sure its compilation is successful. Because if you’re not upgrading both Nodejs & Angular, there is a possibility that their versions might be incompatible with each other.

Ng Update Upgrade

  1. Run ng update @angular/core@14 @angular/cli@14. If there are any peer dependency incompatibility, then manually update only those dependencies to the latest version and then run the command again. Incompatibilities can mostly arise in ng-inline-svg and @angular-eslint/schematics.
  2. Dependencies and Dev dependencies will be updated automatically.
  3. Delete old package-lock.json and run npm install again. New package-lock.json will be generated.
  4. Follow steps 1–3 for upgrading from Angular 14 to Angular 15.

Checkpoint : Your project’s global stylesheet might not pick some imports if you’e using scss. SCSS needs to be updated to CSS.

Java 11 to Java 17

  1. Install JDK 17 in your system and configure your ide to use JDK 17 as your JDK for your project.
  2. Update your Java versions in any yaml files on your project and also in your projet’s pom.
  3. Review Lombok dependency version. Latest version to be used here 1.18.22.

Spring Boot 2.x to Spring Boot 3

  1. Update your pom.xml to use spring boot version 3 .
  2. You’ll need Spring framework 6 and Java 17 to use Spring Boot 3.
  3. Review existing dependencies and specially Spring security dependency.
  4. Review deprecations from Spring Boot 2.x. Some of the classes, methods, properties and annotations that were deprecated in Spring Boot 2.x have been removed in this release. For example, WebSecurityConfigurerAdapter class, @EnableGlobalWebSecurity annotation has been removed. Methods authorizeRequests() and antMatchers() are also changed to authorizeHttpRequests() and requestMatchers() respectively.
  5. As Java EE has been changed to Jakarta EE, Spring Boot 3.0 has also upgraded from Java EE to Jakarta EE APIs for all dependencies. Hence, the package names starting with ‘javax’ need to be changed to ‘jakarta’ accordingly.
  6. If you’re using Spring security, make sure to update the method names mentioned in Step 4.
  7. Compile your application to see if there are any other compilation error.

Resources

  1. Spring Boot 2.x Dependencies
  2. Spring Boot 3.0 Dependencies
  3. Migration from Spring Boot 2.x to 3.0
  4. Angular Version Upgrade

--

--