Results 1 to 8 of 8

Thread: performance ref attribute vs ref local tag

  1. #1
    Join Date
    Nov 2004
    Posts
    9

    Default performance ref attribute vs ref local tag

    In http://www.javalobby.org/java/forums/t44429.html the author proposes to replace ref tags by ref attributes.
    Is there a way with ref attributes to indicate that the needed bean is local?
    Or is this not an issue?
    I 'm having 2 xml files from which one never needs the other.

  2. #2
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    As far as I know, you cannot discern local from non-local references when working with ref-attributes. So a ref-attribute does always behave like "ref bean".

    Regards,
    Andreas

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

    Default

    Yes, ref attribute is equivalent to ref bean. This is also explained inside the reference documentation if I'm not mistaken.
    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

  4. #4
    Join Date
    Nov 2004
    Posts
    9

    Default

    I am considering to slim down the xml files where we will gain readibility and maintainability but I don't know the cost in performance it wil take when I can't use the local attribute.

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

    Default

    You should not think about performance - it's very minor. The parsing happens only one, when the application starts. The main difference between ref local and ref is that ref local applies a DTD constrain so you know if you have some mistakes when you are writing the file (before runtime).
    That's all there is to it!
    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

  6. #6
    Join Date
    Nov 2004
    Posts
    9

    Default

    Thanks for the reply.

    Rereading the ref doc now made it clear, I assumed a bit to much .
    Sorry to have wasted some of your time.

    (there should be a red headed emoticon here, but I hate those fellows)


    Bart

  7. #7

    Default performance ref attribute vs ref local tag

    In my opinion, The main dissimilarity flanked by ref local and ref is that ref local applies a DTD constrain so you be acquainted with if you have some faults when you are writing the file before runtime.

    _____________
    hank freid
    Last edited by hank freid love; Jun 17th, 2008 at 12:19 AM. Reason: for correction text
    fan of hank freid who posted his or her views

  8. #8

    Default

    I would always use <ref local=".." /> instead of the attribute when possible. Two main reasons:
    - You're sure where the bean comes from. This becomes more relevant when your application gets larger and contains multiple chained application context files.
    - The Spring Container will fail earlier in the start-up process when something is wrong (actually when it parses the XML file. XML ID-REF constraints are used when defining a bean reference as 'local').

    In my opinion there is absolutely no noticable performance gain when using the "ref" attribute. The XML file just gets harder to read and it doen not explicitly show the semantics (who of you actually knows for sure that the 'ref' attribute is a <ref bean="..." /> ??? It is not explained in the Reference Manual as far as I know).

Similar Threads

  1. Replies: 1
    Last Post: Jul 28th, 2005, 05:08 PM
  2. stale Oracle processes
    By compostellas in forum Data
    Replies: 7
    Last Post: Jun 27th, 2005, 12:14 PM
  3. MBeanClientInterceptor assumes lower-case Attribute names
    By Joris Kuipers in forum Container
    Replies: 10
    Last Post: Mar 31st, 2005, 09:18 AM
  4. Replies: 6
    Last Post: Mar 6th, 2005, 12:41 PM
  5. Replies: 2
    Last Post: Sep 5th, 2004, 10:49 AM

Posting Permissions

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