Announcement Announcement Module
Collapse
No announcement yet.
java.util.Properties Silly Newbie Question Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

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

    Comment


    • #3
      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, 04:53 AM.

      Comment


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

        Comment


        • #5
          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

          Comment

          Working...
          X