Results 1 to 5 of 5

Thread: java.util.Properties Silly Newbie Question

  1. #1
    Join Date
    Dec 2004
    Posts
    3

    Default java.util.Properties Silly Newbie Question

    Apologies for silly question and thanks in advance for your replies.

    Why can't I read in a java.util.Properties bean? Lists, Maps, homemade beans no problem. The "proper" bean below is always empty when it is read in. There's no error in deploying.

    What is missing?

    Code:
    <bean id="proper" class="java.util.Properties">
     <constructor-arg>
      <props>
       <prop key="one">numberone</prop>
      </props>
     </constructor-arg>
    </bean>

  2. #2
    Join Date
    Aug 2004
    Location
    Carlisle, UK
    Posts
    184

    Default

    I think PropertiesFactoryBean may do what you want.
    It supports loading properties both from a properties file and/or locally.
    See the Javadoc for details.
    Chris Harris
    Carlisle, UK

  3. #3
    Join Date
    Aug 2004
    Location
    Montréal, Canada
    Posts
    845

    Default

    You may also review the following thread properties ref fail as it explains why proper is always empty.
    HTH
    Last edited by robyn; May 19th, 2006 at 04:53 AM.
    Omar Irbouh

    Spring Modules Team
    http://irbouh.blogspot.com/

  4. #4
    Join Date
    Dec 2004
    Posts
    3

    Default

    Thanks for your replies. I ended up using a HashMap workaround.

  5. #5
    Join Date
    Oct 2011
    Posts
    1

    Default Remove the value-Tag

    You have to remove the value Tag in the constructor-arg tag. Example:

    Code:
    <bean id="quartzProperties" class="java.util.Properties">
        <constructor-arg>
            <props>
                <prop key="org.quartz.jobStore.tablePrefix">QRTZ_</prop>
                <prop key="org.quartz.jobStore.selectWithLockSQL">
                    SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?
                </prop>
            </props>
        </constructor-arg>
    </bean>

    Blog article about this topic

    cheers*stephan

Similar Threads

  1. newbie question about the BeanFactory
    By jeroenverhagen in forum Container
    Replies: 3
    Last Post: Sep 22nd, 2005, 04:31 AM
  2. Newbie question - Pet Clinic Sample
    By radone in forum Swing
    Replies: 0
    Last Post: Jul 16th, 2005, 03:50 AM
  3. Replies: 3
    Last Post: Apr 3rd, 2005, 04:34 PM
  4. Replies: 1
    Last Post: Mar 23rd, 2005, 07:22 PM
  5. Newbie question on Pages and Views
    By ragnarwestad in forum Swing
    Replies: 8
    Last Post: Dec 13th, 2004, 10:47 PM

Posting Permissions

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