Spring Boot 3.0 was released 24th of November, 2022. It brought many great changes, like migration to Java 17 and Native Spring Boot executables. It’s a compelling release to update projects to. Also, all packages were migrated from javax.*
package to jakarta.*
. I found it annoying to change packages in each file one by one, so I came up with a simple one-liner that does this job for me:
find . -name '*.java' -exec sed -i 's/javax/jakarta/g' {} +
This script does the following:
finds all “*.java” files in the current directory
passes them to sed
sed
replaces javax
with jakarta
in each of them
Usage:
- Save/Commit all your changes
- Navigate to
src
folder of your Spring Boot project in terminal - Execute one-liner
- Enjoy packages updated to Spring Boot 3.0 standards
That’s it. Thanks for reading. Happy Spring Boot 3.0 migration!