Back Forum Reply New

XML bean definition for controller instead of @Component annotation?

Hello,

With Spring MVC I can normally just annotate a class with @Controller and use component scanning to register it as a Handler.

What if I do not want to use component scanning for this class? If I remove the @Controller annotation and add a quot;manualquot; XML bean definition for the controller, it is added as a Spring bean, but not registered as a Handler. What requirements does a class have to be recognized by the ApplicationContext as Handler? Adding the @RequestMapping annotation on class level did not have any effect.

Thanks,

Florian

It has to either be a @Controller or a Controller... The fact that there is a @Controller doesn't meanyou MUST use component-scanning... Simply leave the @Controller en define it in xml...
¥
Back Forum Reply New