Results 1 to 2 of 2

Thread: Customizing autowiring

  1. #1
    Join Date
    Mar 2008
    Posts
    1

    Default Customizing autowiring

    Hi,
    i intend to build a modular app with springs dynamic (osgi) modules.
    My question is how one can intervene in the auto-wiring process, such that the implementation chosen for an argument / field is dependent on the modules being loaded. Since multiple modules providing each an implementation may be loaded at any given time, "byType" won't do. Qualifiers are not the way to go either, because I wan't the client to be able to override default implementations.

    From studying the API classes, I thought that maybe extending AutowireCandidateResolver is a solution. It could then do whatever logic it sees fit to check a candidate with isAutowireCandidate(). Only thing it would have to do is make sure, that there is but one bean returning "true".

    If that is how to do it, how will I be able to register this extension to AutowireCandidateResolver against my ApplicationContext? Afaik the interface is not one of the automatically registerable components.

    Greetings,
    Murat

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Murat, there shouldn't be any problems with autowire by type in OSGi - even if there are multiple types inside the platform, your bundle will use only one version so inside your bundle, there will be no ambiguity.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •