For a bean :
@Autowired
private MyBean myBean;
Is this bean autowired before :
@RequestMapping("VIEW")
public String showView {
//myBean is null here
}
Reason I'm asking is that myBean is set to null. However for other beans which have
@RenderMapping("NORMAL")
public String renderNormal{
//myBean is not null here
}
myBean seems to be autowired correctly.
Is @RequestMapping("VIEW")
causing myBean to not be wired or is being invoked before Spring autowires myBean ? If so how I can I configure Spring to wire myBean before entering method showView ?
Update : I was missing <context:annotation-config />
in Spring context file, this question provides some detail on its use : Difference between <context:annotation-config> vs <context:component-scan>