Using spring on a webservice I have this code:
@RequestMapping(value = "/testOperation", method = GET)
public String testOperation() throws Exception
{
ts.setName("First Value");
ts.name = "Second Value";
return ts.getName() + " and " + ts.name;
}
The response received is "First Value and Second Value". I do not understand why is not "Second Value and Second Value". ts is a request scope injected variable. The code is:
@Component
@Scope(value=WebApplicationContext.SCOPE_REQUEST, proxyMode=ScopedProxyMode.TARGET_CLASS)
public class TS implements Serializable{
public String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
I do not understand this behavior