5 Replies Latest reply on Aug 28, 2007 5:46 PM by samdoyle

    Injection vs. property

    gstacey

      I'm fairly new to Seam. I have a small project working and I like working with it so far, but I have a best practices type question...

      Is it better to inject properties into your beans or just use getters/setters?

      e.g.

      @Name("groupEditor")
      public class EditGroupBean implements EditGroup
      {
      ...
       private Group myGroup;
      
       public Group getGroup()
       {
       return myGroup;
       }
      
       public void setGroup(Group group)
       {
       myGroup = group;
       }
      ...
      }
      


      accessed via groupEditor.group.propertyName

      or
      @Name("groupEditor")
      public class EditGroupBean implements EditGroup
      {
      ...
       @In (required=false)
       @Out (required=false)
       private Group group;
      ...
      }
      


      accessed via group.propertyName

      Are there advantages / disadvantages to either approach?

      Thanks