Results 1 to 6 of 6

Thread: selective autowiring

Hybrid View

  1. #1
    Join Date
    Jul 2006
    Posts
    17

    Default selective autowiring

    I want only certain beans to be injected into other beans using autowiring by type.

    With the "autowire" attribute, you can control whether or not a bean's properties are autowired, but I would rather turn on auto-wire globally but limit which beans can be automatically injected. Will this be possible in Spring 2.0? (And if I'm missing something, is it already possible in 1.0?)

  2. #2
    Join Date
    Sep 2004
    Posts
    1,086

    Default

    Use the default-autowire="byType" for the beans element and autowire="no" for individual bean elements you don't want to autowire.

  3. #3
    Join Date
    Jul 2006
    Posts
    17

    Default

    Quote Originally Posted by dejanp
    Use the default-autowire="byType" for the beans element and autowire="no" for individual bean elements you don't want to autowire.
    I think you misread my post.
    I don't want to specify that a bean's dependencies should be injected. That is definitely possible in spring 1.0

    I want to specify that only some specific beans should be injected into other beans via autowiring. (That is marking a bean as "injectable" or something like that)

  4. #4
    Join Date
    Sep 2004
    Posts
    1,086

    Default

    You are right, sorry. I think what you need is autowire-candidate="false", available in Spring 2.

  5. #5
    Join Date
    Jul 2006
    Posts
    17

    Default

    Quote Originally Posted by dejanp
    You are right, sorry. I think what you need is autowire-candidate="false", available in Spring 2.
    Thanks. That sounds exactly what I was looking for.
    Do you happen to know if there's a "default-autowire-candiate" option for beans available as well?

  6. #6
    Join Date
    Jul 2006
    Posts
    17

    Default

    To answer my own question: No, there isn't such a default. (At least not in the rc2 DTD).

Posting Permissions

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