Announcement Announcement Module
Collapse
No announcement yet.
i wanna IOC support the configuration which can reduce 50% size Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • i wanna IOC support the configuration which can reduce 50% size

    hi,i come from China,and like spring very much.
    I want I can write the xml from:
    =================================================
    <bean id="classA" class="classA" />
    <bean id="classB" class="classB" />
    <bean id="classC" class="classC" />

    <bean id="classD" class="classD">
    <property name="classA" ref="classA"/>
    <property name="classB" ref="classB"/>
    <property name="classC" ref="classC"/>
    </bean>
    to:
    ==================================================
    <bean id="classA" class="classA" />
    <bean id="classB" class="classB" />
    <bean id="classC" class="classC" />

    <bean id="classD" class="classD">
    <property refIds="classA,classB,classC"/>
    </bean>

    It can save lots of pace.I hope it be supported in 2.0 thanks.

    best regards.

  • #2
    Check the documentation for autowiring. Personally I don't like it because it makes the configuration less clear, but you could give it a try.

    Comment


    • #3
      Originally posted by Alarmnummer
      Check the documentation for autowiring. Personally I don't like it because it makes the configuration less clear, but you could give it a try.
      I know.but I think autowirting have some problems.
      First ,the names must be equal.
      Second,it is hard to find wiring because of some problems ,such as spelling mistake.
      Tird,If I change the bean'id,it dose not work.and cant report the problem if you
      does not test the application.
      Fourth, I think the configuration work should to hand to our to set.

      Comment


      • #4
        why don't you use a <list/> for that?

        Comment


        • #5
          Originally posted by Injecteer
          why don't you use a <list/> for that?
          How to do that?
          I write
          <property refIds="classA,classB,classC"/>
          to finish three properties injected.
          so change three llines to one line.

          Comment


          • #6
            In autowiring, the context finds what it should use. With this approach, you constrain it. pros are:
            less verbose declarations, use of auto-wiring (kindof).
            Cons are many. what if you have multiple fields of same type, and you list a bunch of references and these too have multiple types that are applicable, which should go to which field?
            Maybe instead of just
            <property refIds="classA,classB,classC"/>

            it could be
            <property refids="fld1=classA,fld2=classB,fld3=classC"/>
            This removes the autowiring.

            Comment


            • #7
              Originally posted by jbetancourt
              In autowiring, the context finds what it should use. With this approach, you constrain it. pros are:
              less verbose declarations, use of auto-wiring (kindof).
              Cons are many. what if you have multiple fields of same type, and you list a bunch of references and these too have multiple types that are applicable, which should go to which field?
              Maybe instead of just
              <property refIds="classA,classB,classC"/>

              it could be
              <property refids="fld1=classA,fld2=classB,fld3=classC"/>
              This removes the autowiring.
              I like the sample you provider.
              <property refids="fld1=classA,fld2=classB,fld3=classC"/>
              I hope it would support it.

              Comment


              • #8
                Why don't you raise an issue on JIRA? If it is approved it might get into Spring 2.1 (2.0 is just around the corner).

                Comment

                Working...
                X