Replies: 2 comments 3 replies
-
/cc @geoand (kotlin) |
Beta Was this translation helpful? Give feedback.
0 replies
-
So you are trying to obtain the beans outside of a Quarkus application? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am writing a testing framework in Kotlin language that supports multiple frameworks so far, SpringBoot, Ktor, Micronaut and the last integration is Quarkus.
One of the features of the testing framework is that keeping the reference of the dependency injection container of the application, so from the test context we can resolve a dependency if needed.
Every app starts with a main, quarkus also no different, but when it comes to accesing it's BeanManager things are getting a bit tricky. For the other frameworks aforementioned it is relatively easy.
Let's imagina a Quarkus main app;
note: code can be found: /~https://github.com/Trendyol/stove/tree/main/recipes/java-recipes/quarkus-recipe
And then configuring the testing framework, kotlin code:
So, usually I would seperate the app's main from the code its running. Meaning, there are two entrances to the app, the one that
java
process enters which ismain
itself, the other one that Stove enters, usually named asrun (args)
, and the second one theoretically as follows;I've tried lots of different things so far, creating a beanHolder class to access it here and set statically and use it in testing, didn't work, best case scenario is I was able to access to BeanManager but resolving a bean would cause a
LinkageError
due to classloaders are different, even though I tried to align the class loaders of the threads.I am no Quarkus expert, so my options are exhausted. Looking for some inspiration or guidance.
Thanks in advance!
Relates to: Trendyol/stove#714
Beta Was this translation helpful? Give feedback.
All reactions