Coder Social home page Coder Social logo

public static void setInstance(RestClientBuilderResolver resolver) is an implementation leak and should be dropped from the API about microprofile-rest-client HOT 11 OPEN

eclipse avatar eclipse commented on August 17, 2024
public static void setInstance(RestClientBuilderResolver resolver) is an implementation leak and should be dropped from the API

from microprofile-rest-client.

Comments (11)

andymc12 avatar andymc12 commented on August 17, 2024 1

Per discussion in eclipse/microprofile-open-api#224 the resolution of this issue should be to put the RestClientBuilderResolver (and any other SPI code) into a separate SPI artifact - so that vendors can implement this spec without allowing end-users to be able to call SPI methods.

from microprofile-rest-client.

andymc12 avatar andymc12 commented on August 17, 2024 1

CXF does not use the setInstance method, so from that implementor's standpoint, it could be removed. It would be good to know whether other implementors use it or not.

We'd probably need to deprecate it first.

from microprofile-rest-client.

rmannibucau avatar rmannibucau commented on August 17, 2024

Any rational to keep this method since multiple threads qhowed osgi and other envs dont need it? Others are ok to extract even if pby overkill.

from microprofile-rest-client.

OndroMih avatar OndroMih commented on August 17, 2024

It's often the only way how to set a custom resolver in an OSGi environment. I think that @Emily-Jiang has some opinion about this. In Payara, the resolver is provided via the service loader mechanism.

from microprofile-rest-client.

rmannibucau avatar rmannibucau commented on August 17, 2024

@OndrejM I know it is what @Emily-Jiang keeps saying but this is not true and there are OSGi solution nowdays which avoid to break the API introducing some vendor specific implementations, please have a look to eclipse/microprofile#33 or geronimo which does it since almost 20 years without any need of API tweak.

from microprofile-rest-client.

OndroMih avatar OndroMih commented on August 17, 2024

I believe, @rmannibucau. I even think that the API doesn't need to support the service loader pattern, which is also impl-specific. The SPI package exists only to make it easier to create implementations. Maybe a better solution is to provide an SPI to provide an impl-specific extension, which could provide implementations in any way

from microprofile-rest-client.

rmannibucau avatar rmannibucau commented on August 17, 2024

Agree, if you think 2s about here is concrete status of that particular point:

  1. JavaEE always used SPI so MP "copied" that pattern but (point 2)
  2. MP is CDI centric so the way to have a SPI is to use CDI beans. MP API would provide an interface and the implementation would add a bean for that type. it works for 90% of the cases but the config one which is needed before the container is started but that's really all.

Sounds like a trivial fix, no?

from microprofile-rest-client.

OndroMih avatar OndroMih commented on August 17, 2024

It sounds OK to me to use CDI for providing implementations for specs that can rely on CDI. Most of them should except the config one you mentioned.

from microprofile-rest-client.

OndroMih avatar OndroMih commented on August 17, 2024

It is obvious from the discussion in eclipse/microprofile-open-api#224 that this pattern is used in many other specs (config, REST client, openapi). This should then be discussed on a higher level at the architecture board. I raised an issue here: eclipse/microprofile#43

from microprofile-rest-client.

Emily-Jiang avatar Emily-Jiang commented on August 17, 2024

close this as it has been resolved. Please reopen if you think otherwise.

from microprofile-rest-client.

rmannibucau avatar rmannibucau commented on August 17, 2024

Hmm, AFAIK there is no change in the API and the buggy method is still surfacing so this issue is still valid since:

  • in terms of design it creates inconsistencies with CDI depending the environment (in OSGi-CDI for ex the classloading is not sufficient so if it would use CDI there wouldn't be any issue but there it is random)
  • it is not generally working since it can be called any time and a consumer code can get the unexpected resolver
  • as originally mentionned it is a design bug of a few spec but since MP is CDI centric there is no real reason to keep this broken pattern in the spec so the method should be deprecated and implemented as a noop when possible (to not break compilation immediately) then dropped in a few versions IMHO

from microprofile-rest-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.