I have a springboot application recently migrated to spring boot 2.7.0. I am facing a problem on intellij. My application consists of application-dev.properties application-local.properties ...
Before migration I would edit the run configurations and add VM option and give the value -Dspring.profiles.active=local and spring would automatically select application-local properties. When I try the same with the new version it is no longer working. It always defaults to application.properties which holds production config.
while I was checking some threads on stackoverflow they suggested that we should segregate the application-{env}.properties based on env and have a default application.properties which contains property spring.profile.active=local; this works but I want to know if there is a better way to do this by setting up a env variable or vm option

IntelliJ offers a way to set the profile for spring boot app in the run configuration. See below "Active profiles". You can still add environment variable
SPRING_PROFILES_ACTIVE=local