Announcement Announcement Module
Collapse
No announcement yet.
selective autowiring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    Use the default-autowire="byType" for the beans element and autowire="no" for individual bean elements you don't want to autowire.

    Comment


    • #3
      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)

      Comment


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

        Comment


        • #5
          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?

          Comment


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

            Comment

            Working...
            X