Spring profile management #764
Comments
Hi Nicolas, could you please detail how do you pass |
It seems as if at runtime, all candidate beans are part of the context and no profile-related filtering occurs. |
I don't think passing |
You can use |
After an additional discussion with Nicolas, it seems indeed we need to refine profile management to work as expected. |
I put it in the backlog for now, since I don't know how involved it is. We can move it to 0.1x as soon as somebody tackle this one. |
I've just done some tests with Spring Native 0.10.0 and I confirm that Spring profiles ( the I even tested using one bean with |
Let's re-evaluate that one after 0.11 which will change a lot of related things. |
After digging into #888 - I think some of the problem here may simply be that there is no type hint for |
@nfrankel Could you please do more tests with |
Same
|
Alright, I can try specifically on that pet clinic rest sample. I've been unable to create a profile problem with my playing around (doesn't mean there isn't one, I just can't in a simple case). @nfrankel do you by any chance have a fork of how far you've gotten it? |
Sure https://github.com/nfrankel/spring-petclinic-rest/tree/native Thanks for your help |
I actually took Without Profile in a hint the app fails in the way described. With Profile, it doesn't fail with that, it fails with something else. I think it is missing a bunch of config for other things (spring fox, swagger) - so I used the agent to collect that missing config. I tweaked it a little but it is still more verbose than it needs to be, the config is here: I also modified the pom.xml in my fork so I could build locally without the docker buildpack need. With that config I can run:
Now I will say the app doesn't work for me (I get an error page for http://localhost:9966/petclinic - in either JVM or the native-image), so I've just been debugging startup and the app now starts for me. I tried passing the jdbc profile and the app fails but I just think it is more missing configuration. I didn't run the JVM app with that profile and the agent to collect extra config, that could be a next step. But I think the fundamental issue here, that profiles were misbehaving, is fixed. The addition of |
I'm a bit confused: should I do something, or is it on your side? |
No, you don't need to do anything. The hints for the Profile/ActiveProfiles are built in now (0.10.2 snapshots). Your app can start without the error in the first comment of this issue. However, the app has other issues because we don't have defined configuration for all those other libraries. |
Perfect
Yes, I started to configure those libraries Thanks for your help! |
I've just rebuilt the image using the latest snapshot:
I launch the application with profiles:
I now have another kind of error:
It seems I lack the reflection configuration for a Spring class ( |
As I recall, the app lacks many many different kinds of configuration (and when one is missing they won't all present in an obvious way like that). It'll be slow going unless you use the agent to collect them (are you using it?) We could probably add |
Sorry for the delay, I'm back on it. I've added the In all cases, I do believe that if you want to improve the developer experience, it should be included in the out-of-the-box configuration. There are two use-cases:
|
Let's try to see if we can allow to set AOT profiles with maybe predefined ones for |
I tend to think this issue duplicates #1411 which provide a documented way to use profiles with the AOT engine. |
Nitpick: the link to the documented way is wrong. |
Oups fixed thanks. |
I'm trying to "GraalVM-native"-ify the Spring PetClinic REST. I managed to fix expected configuration issues. However, I'm stuck now on Spring profiles.
The application offers several profiles: one set for data access and one for database. When I start the native image, I get the following:
While the JVM will automatically select the bean that matches the correct profile, the Native Image cannot.
I tried with the default command line and by passing
-Dspring.profiles.active=jdbc
. The logs display respectively the default profile and thejdbc
one but the problem is the same.I didn't find anything related to profile management in the documentation.
The text was updated successfully, but these errors were encountered: