Results 1 to 2 of 2

Thread: util:constant and map *values*?

  1. #1
    Join Date
    May 2007
    Location
    Brisbane, Australia
    Posts
    97

    Default util:constant and map *values*?

    This little snippet:
    Code:
      <bean> 
        <property name="...">
          <map>
            <entry>
              <key
                <util:constant static-field="some.class.CONSTANT" />
              </key>
              <value><util:constant static-field="some.class.OTHER_CONSTANT" /></value>
            </entry>
          </map>
        </property>
      </bean>
    Seems to throw the error:
    Code:
    Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.d: Invalid content was found starting with element 'util:constant'. No child element is expected at this point.
    	at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    Does this mean that constants can't be used as map values?

  2. #2
    Join Date
    Nov 2012
    Posts
    1

    Default

    Quote Originally Posted by tunaranch View Post
    Does this mean that constants can't be used as map values?
    No it doesn't mean that. Just keep <value> tag out. Like that:
    Code:
    <entry>
      <key
        <util:constant static-field="some.class.CONSTANT" />
      </key>
      <util:constant static-field="some.class.OTHER_CONSTANT" />
    </entry>

Posting Permissions

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