2 Replies Latest reply on Jul 2, 2008 2:52 PM by Christian Blumenroehr

    Setting a property via components.xml

    Christian Blumenroehr Newbie

      All,


      I have a Seam component that should be initialized during startup:


      
      @Startup
      
      @Scope(ScopeType.APPLICATION)
      
      @Name("PropertiesLoader")
      
      public class HDcomPropertiesLoader {
      
       private String configDir;
      
       
      
       ...
      
      


      The value for the configDir property is environment specific and is therefore externalized and set in components.xml:


      
      <component name="hdcomPropertiesLoader">
      
         <property name="configDir">aCertainPath
      
         </property> 
      
      </component>
      
      



      I want now to read in some properties files during startup. Therefore I have added a corresponding functionality in the constructor of the class. The problem is however that Seam calls the setter for configDir after the constructor so I cannot set the path before. As a workaround I put now the functionality in the setter instead of the constructor, but that seems of course weired to me.


      Is there a reason why this order is in place or is it a bug?


      Regards,
      Christian