[jboss-user] [JBoss Seam] - Injection vs. property
gstacey
do-not-reply at jboss.com
Mon Aug 27 14:02:36 EDT 2007
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
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4078459#4078459
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4078459
More information about the jboss-user
mailing list