The profiles specified when running AOT should be retained and used at runtime when starting the AOT processed application.

It's confusing that an application can be built with e.g. profile-a, uses the beans in that profile, but doesn't log that profile on startup. Users can specify spring.profiles.active=profile-a when running the AOT processed app, and then the log messages (and the configuration file loading for profile-a) happens, but I think this should be done automatically.

Comment From: snicoll

This might be a framework issue where the profile information is retained and set as part of the bean factory bootstrap. I am moving it.

Comment From: lgklein

I think this would be a nice improvement, but it shouldn't make it impossible to change the profile on application startup...

Some settings need to change from environment to environment (database url, users, etc) and having to recompile the application to each environment is simply unfeasible and too expensive (for public cloud environments, it's literally a waste of money).

Comment From: mhalbritter

You can totally change properties when running a native image. Only properties which change bean creation are not possible. See https://github.com/spring-projects/spring-boot/issues/35262.

Comment From: snicoll

What I have in mind is something where Environment#getActiveProfiles() would return the profiles that have been used by AOT. If the command line provides additional profiles, those will be "added" and taken into account. There is plan of changing the behavior but rather to make the logging more consistent.

Right now if you process an application with the prod profile enabled, starting the native image without any other argument will not enable that profile.

Comment From: snicoll

It's a bit late to make such a change so I am going to move this and I'll try to make it happen in M1 to give us enough time to get feedback.