Results 1 to 8 of 8

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

  1. #1
    Join Date
    Aug 2006
    Posts
    4

    Default 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. #2
    Join Date
    Nov 2004
    Location
    Hilversum - The Netherlands
    Posts
    1,054

    Default

    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.

  3. #3
    Join Date
    Aug 2006
    Posts
    4

    Default

    Quote 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.

  4. #4
    Join Date
    Dec 2005
    Posts
    269

    Default

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

  5. #5
    Join Date
    Aug 2006
    Posts
    4

    Default

    Quote 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.

  6. #6
    Join Date
    Aug 2004
    Location
    u.s.a
    Posts
    399

    Default

    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.

  7. #7
    Join Date
    Aug 2006
    Posts
    4

    Default

    Quote 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.

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

    Default

    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).
    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
  •