-
We use the Java Money library in most of our projects. The library initializes its components with SPIs which are not really compatible with Quarkus. For this we have implemented our own ServiceProvider which initializes the respective components statically. I would like to implement a Quarkus extension that does this neatly. Maybe I could implement an own service provider which registers the components via CDI. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 14 replies
-
What problems did you encounter with using the SPIs in Quarkus? |
Beta Was this translation helpful? Give feedback.
-
I looked into this real quickly and I agree there should be an extension. For starters, it likely simply needs to do something like: @BuildStep
public void spiRegistration(BuildProducer<ServiceProviderBuildItem> producer) {
producer.produce(ServiceProviderBuildItem.allProvidersFromClassPath(MonetaryConversionsSingletonSpi.class.getName()));
producer.produce(ServiceProviderBuildItem.allProvidersFromClassPath(MonetaryAmountFactoryProviderSpi.class.getName()));
// register all other SPI classes defined in moneta
} |
Beta Was this translation helpful? Give feedback.
-
Not entirely related to the original question since we are using Quarkus 3, but we also have an issue with JavaMoney in our project. I created a reproducer if it's of any help and started off a thread in SO too before I was pointed to this direction. I just got started with GraalVM and native image build with Quarkus, is there a way to actually work around the issue or the only solution is to wait for JavaMoney to release a new version? Error:
|
Beta Was this translation helpful? Give feedback.
-
I have now released a first version of the extension which takes both discussed topics into account. On the one hand the service providers are registered and on the other hand the dependency is transformed with the Eclipse Transformer. |
Beta Was this translation helpful? Give feedback.
Another option could be to develop a small javax.money extension and use a trick similar to https://github.com/quarkusio/quarkus/blob/main/extensions/quartz/deployment/src/main/java/io/quarkus/quartz/deployment/JakartaEnablement.java .