To avoid this headache (and many similar ones) I highly recommend using the OpenRewrite Spring Boot Migrate recipe
I know it's been three years since Spring Boot 3.0.0 was released, but I'm only just now dealing with the upgrade from 2.7. I was able to use OpenRewrite to upgrade from 2.7.18 to the latest 3.3.x version and it completely automated away the javax -> jakarta
migration among many other tedious tasks.