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
Document that active profiles are set at build time with AOT #32543
Comments
Unfortunately, there is not enough information for us to know what's going on. If you would like us to spend some time investigating, please provide a complete minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it and attaching it to this issue. |
Thanks for your reply. Here is the minimal sample https://github.com/luooyii/BugDemo |
I think this is because of #30421. |
As mentioned by Moritz, this is by design. I haven’t seen a specific mention of that in our AOT reference docs so let’s turn this into a documentation isssue. |
Thanks all for your answers. But I think it would be a better way that the AOT compilation product can be consistent with the behavior of jar packages. I use this way to make the AOT compilation package not activate any configurations, and I'm curious if this should be a default configuration when native compilation is enabled. |
This is a Maven usage question that you should rather ask on StackOverflow. I don't know what that The whole point is that AOT must be configured to match your target environment, so it's not about dev polluting anything. |
It isn't a maven usage question. The problem is the inconsistent startup behavior of the AOT compilation and the jar package. I had to modify maven config to get the behavior consistent. |
I understood your problem and I still think this is a Maven usage question. AOT is processing your app at build time with the goal of preparing for your target environment (that's probably your "cluster" profile). Not doing anything means that you let all the default apply. If you have a default profile that's development only, it's your choice and it will be enabled. You should rather configure the Another reason this is a maven usage question is that the |
Okay, I got your point. |
I'm not sure if this is a bug.
I am using Spring Boot 3.2.3 and GraalVM CE 21.
Here are the context in application.yaml and yaml files under resources folder.
If I startup the service jar file with cmd "java -jar app.jar --spring.profiles.active=cluster". Activation item will be overridden and only one profile is actived. Here is the spring output log.
2024-03-21 01:01:23.325 [main][0;39m - The following 1 profile is active: "cluster"
But if I use graalvm native image to compile the service and startup AOT package with the same param, just like "./app --spring.profiles.active=cluster". Both "local" and "cluster" will be activated. Here is the spring output.
2024-03-26 15:29:23.448 [main][0;39m - The following 2 profiles are active: "cluster", "local"
The text was updated successfully, but these errors were encountered: