Gabriela Rios wrote:I added <context:annotation-config/> but that didn't fix the problem.
You would have also had to remove the component scans from the root context that were scanning packages that had session factory dependencies, then it would have worked. It is important to understand what Spring is doing for you here. I gave you something to search in the reference documentation but Mark also explained it above. The component scan will create spring managed beans from any class with one of the stereo type annotations component, service, repository etc. It will only create one of these regardless of how many times you scan the same package. Because your servlet configuration is not visible to the root (parent) those component scans you left in your root were creating beans without having the dependencies defined.
So you had one of 2 options
1. define everything in the root like you did (this probably makes more sense unless there is a specific reason you wanted it scoped to the servlet)
2. leave it as you had it add the context-annotation-config to the servlet.xml and remove the component scans from the root.
Just note that context-annotation-config is not inherited from the parent root if you need it, it must be defined in each config which is what I was trying bring your attention to.
Glad you got it resolved though