[jboss-user] [JBoss Seam] - Post-injection hook (or how to avoid injection races?)

thatrichard do-not-reply at jboss.com
Sun Aug 5 05:15:01 EDT 2007


Consider this component


  | @Name("personEditor")
  | @Stateful
  | @Scope(ScopeType.CONVERSATION)
  | @Conversational	
  | public class PersonEditorBean implements PersonEditor {
  | 
  |    @In
  |    private Person person;
  | 
  |    @In
  |    public void setTitle(String title) {
  |        //modify the title
  |        person.setTitle(title);
  |    }
  |  
  | 

This code will only work when "Person" is injected before "Title".  What I think I need to do is to modify the setTitle method to store the value in a proxy and invoke another method, post-injection, to handle the modification, i.e.


  |    @In
  |    private Person person;
  | 
  |    private String titleProxy;
  | 
  |    @In
  |    public void setTitle(String title) {
  |        titleProxy = title;
  |    }
  | 
  |    private void updateTitle() {
  |       //modify titleProxy
  |       person.setTitle(titleProxy);
  |    }
  | 
  | 

For this to work I need a way of invoking the "updateTitle" method after injection, i.e. a post-injection hook.  I am sure Seam supports something like this, but I'm not finding it.

Can someone point me in the right direction?

Richard

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4070948#4070948

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4070948



More information about the jboss-user mailing list