Skip to content

Retain profiles used when running AOT #30421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mhalbritter opened this issue May 4, 2023 · 5 comments
Closed

Retain profiles used when running AOT #30421

mhalbritter opened this issue May 4, 2023 · 5 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Milestone

Comments

@mhalbritter
Copy link
Contributor

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.

@mhalbritter mhalbritter added type: enhancement A general enhancement theme: aot An issue related to Ahead-of-time processing labels May 4, 2023
@snicoll
Copy link
Member

snicoll commented May 4, 2023

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.

@snicoll snicoll transferred this issue from spring-projects/spring-boot May 4, 2023
@snicoll snicoll added this to the 6.0.x milestone May 4, 2023
@snicoll snicoll added type: bug A general bug in: core Issues in core modules (aop, beans, core, context, expression) and removed type: enhancement A general enhancement labels May 4, 2023
@lgklein
Copy link

lgklein commented May 5, 2023

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).

@mhalbritter
Copy link
Contributor Author

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

@snicoll
Copy link
Member

snicoll commented May 5, 2023

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.

@jhoeller jhoeller assigned sbrannen and snicoll and unassigned sbrannen Jun 4, 2023
@snicoll snicoll modified the milestones: 6.0.x, 6.1.0-M1 Jun 5, 2023
@snicoll
Copy link
Member

snicoll commented Jun 5, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants