Dear ivyteam In our project we'd like to have the following structure: Our ivy project contains a jar which has some Java interfaces. Then we'd like the implementations for these interfaces in another external jar that we can deploy independently. Our idea was to put into the WEB-INF/lib folder. But if we try to load the class from the jar (using Best regards Lars asked 09.07.2019 at 07:31 Lars Tuchel |
Hi Lars This will not work because the class loader hierarchy is exactly the opposite. This means the projects class loader has the web application class loader as parent. E.g. the project can load classes from WEB-INF/lib but not vice versa. Can you tell me the use case behing your question? Regards Reto Weiss, Axon.ivy Support answered 09.07.2019 at 11:28 Reto Weiss ♦♦ Hi Reto Ok, I see. Thank you, Reto. Basically we have some external services for which we define the interfaces in our projects. Then we'd like other third-party developers (that might not use ivy) to implement these interfaces. The approach works with both the interfaces and the implementation in WEB-INF/lib, but we would have preferred to deliver our interfaces directly with our iars.
(10.07.2019 at 02:12)
Lars Tuchel
Hi Lars How have you planed to inject the implementation into the project then? Or how can the project get an instance of the implementation?
(10.07.2019 at 02:37)
Reto Weiss ♦♦
There's a config file, where we can specify which implementation to use on a given environment and then we use guice to configure the inferfaces/implementations
(10.07.2019 at 04:27)
Lars Tuchel
What if the implementation is in one project (lets say 'customer') and the interface is in another one (lets say 'standard'). Then the 'customer' project depends on 'standard'. Now 'standard' could evaluate all projects that depend on it and read the di config file from them and install this info into Guice. Then 'standard' shoud be able to inject an implementation of the interface into itselft. Be aware: The you have to ensure that the implementation class needs to be loaded with the classlaoder from 'customer' and not with the class laoder from 'standard'. But this should be possible.
(11.07.2019 at 02:51)
Reto Weiss ♦♦
If you want to discuss this scenario in depth we can do a Skype call or organize a short meeting
(11.07.2019 at 02:53)
Reto Weiss ♦♦
|
Once you sign in you will be able to subscribe for any updates here
By RSS:Markdown Basics
Tags:
Asked: 09.07.2019 at 07:31
Seen: 1,372 times
Last updated: 11.07.2019 at 02:53
This is an interesiting problem. Suppose we could have a way by some ClassLoader black magic, how do you plan to deal with situation that different IARs depend on different version of the interface JARs. How to load the correct impl of the correct version? Something like versioning using package name may create a mess, I guess.