Dec 12th, 2012, 06:04 AM
mvc:annotation-driven needs to be used next to the component-scan (unless you configure all your @Controllers by hand)... It isn't a replacement...
There aren't any conflicts I know about between the 2... Could you post the stacktrace? Switching to java based configuration shouldn't solve the problem because you still need component-scan and annotation-driven (@ComponentScan and @EnableWebMvc) ... So that isn't the solution...
And could you also post your original configuration and maybe a controller? (There might be something conflicting in there!).
One thing about the component-scan (and you wouldn't be the first to fall in that trap) is that there is also one in the ContextLoaderLIstener with the same base package which leads to duplication of all your beans! A rule of thumb your component-scan for the dispatcherservlet should (in general) only be scanning for @Controllers (in short disable default filters and add a include-filter for the Controller annotation). And your ContextLoaderListener for anything BUT @Controller (simply include an exclusion for @Controller).
Last edited by Marten Deinum; Dec 12th, 2012 at 06:06 AM.
Reason: Add component-scan note.