I am developing a small application with Struts2 + Spring + hibernate...Spring beans are injected properly on server start-up .. I have stepped through the setters on start up and they are injecting properly. However, I run the post method and then the post method(execute() in struts2) and the values that were injected are null. Why does this happen?
Bean injection is :
<bean id="userAction" class="com.example.user.action.UserAction">
<constructor-arg index="0">
<ref bean="UserServiceTarget"/>
</constructor-arg>
</bean>
My Struts2 constructor is :
public UserAction(IUserService userService)
{
this.userService=userService;
}
Struts2 method is :
public String execute() {
this.user=(User)userService.findById(this.id);
}
But inside execute method userService value is null... When i inject they are injected prperly..
Thank you...