Announcement Announcement Module
No announcement yet.
File Managment Capability Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • File Managment Capability

    I want to know the file management capability of spring. I have some custom xml and property files that I use to store some configuration paramaters(business related) that I use in my application. Does spring provide any capability for this already so I do not have to maintain these myself ? Currenly I am parsing these file and storing the configuration as a in memory object for quick access.

  • #2
    Addition to above

    I am thinking I can use Application Context to do this. I dont know exactly how. Currently I have defined a bean with all the configuration in it like

    <bean id="applicationConfig" class="framework.utility.ApplicationConfig">
    <!-- results in a set..(java.util.Properties) call -->
    <property name="config">
    <prop key="a">true</prop>
    <prop key="c">1</prop>
    <prop key="b">test</prop>

    And I am explicitly wiring this bean into the beans that need the configuration. I am thinking if this can be wired into the application context so I dont need to explicitly wire into each bean. If this is possible and how ?


    • #3
      yes it does. It provides access to config data stored as properties files (xml format also), and of course, it provides a bean configuration schema to "store" beans that of course could also contain data.

      For example, you could store data in a list as part of a bean's definition, so there is no explicity binding needed (Spring will do that).
      So a quick and dirty approach could be:
      <bean id="networkAddresses" ......
      <props> ........... the actual data as inline list.

      As to custom xml formats or even extended prop file formats, not that I'm aware of. Of course, there are projects out there that add light weight DB such as XML databases, and using an embedded HSQLDB is very practical (such as using its csv import stuff).