0 Replies Latest reply: May 20, 2012 3:21 AM by riboriori riboriori RSS

Producers, injection point and custom context

riboriori riboriori Newbie

i post this question here because in weld forum i havent no feedback.

 

i've developed a custom context that is similar to @viewScoped context.

I have two controllers , say ActionA, ActionB, in order to implements a test wizard.

 

 

 

@CustomScoped@Named("actionA")public class ActionA{ private String var1; @Produces @Named("var1")public String getVar1(){  return var1;} public void setVar1(String var1){this.var1 = var1;}   }

 

 

 

@CustomScoped

@Named("actionB")

public class ActionB{

 

private String var2;

@Inject @Named("var1") String var1;

 

public String getVar2(){

return var2;

}

 

public void setVar2(String var2){

this.var2 = var2;

}

 

public void endWizard(){

System.out.println("var1 is: " + var1);

}

 

}

 

 

 

 

Steps:

1) Go to ActionA, make var1 equals to "var1";

2) Go to ActionB, make var2 equals to "var2";

3) Invoke endWizard method of ActionB class and i can read into the consolle "var1 is: var1";

4) Go back to ActionA and make var1 equals to "var1_second_change";

5) Go forward to ActionB, invoke endWizard method of ActionB class and i read into the consolle "var1 is: var1", when i expect to read "var1 is: var1_second_change";

 

In my custom context, instead i can see that var1 field of instance of ActionA controller contains correct value (var1 in fact is equals to "var1_second_change" value).

I cant understand why that newly value cant be updated

 

Can anyone help me?

P.S. Sorry my english is bad.