简体   繁体   English

@RequestMapping 没有 @Controller 注释

[英]@RequestMapping without @Controller annotation

Is it possible to use @RequestMapping annoation in controller class without the use of @Controller annotation for controller class i will register the bean i am asking this coz @Controller class if i deploy as jar file it not working properly so any help? Is it possible to use @RequestMapping annoation in controller class without the use of @Controller annotation for controller class i will register the bean i am asking this coz @Controller class if i deploy as jar file it not working properly so any help?

You need <context:component-scan base-package="com.yourpackage" /> to activate annotations.您需要<context:component-scan base-package="com.yourpackage" />来激活注释。

As for the question - your bean should be a controller in order to be eligible for request mapping.至于问题 - 您的 bean 应该是 controller 以便有资格进行请求映射。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 @RequestMapping注释 - @RequestMapping Annotation 为什么 Spring RequestMapping 在没有@Controller 的情况下无法工作? - Why Spring RequestMapping not working without @Controller? RequestMappingHandlerMapping的isHandler方法重调谐为RequestMapping和Controller注释都为true - isHandler Method of RequestMappingHandlerMapping retunrs true for both RequestMapping and Controller annotation 在Java控制器上,如何获取批注@RequestMapping(“ / getThisValueFromOtherClass”)的值? - On Java Controller how to get the value of annotation @RequestMapping(“/getThisValueFromOtherClass”)? 缩小Spring MVC基于注释的控制器和@RequestMapping的问题 - Narrowing problem with Spring MVC annotation-based controller and @RequestMapping Spring 提取Controller的HandlerInterceptor中的@RequestMapping注解和Method组成全路径 - Spring extract @RequestMapping annotation in HandlerInterceptor of Controller and Method to form full path 为什么控制器中的@RequestMapping Spring注释会捕获更多我想要的? - Why does @RequestMapping Spring annotation in controller capture more that I want? 在RequestMapping批注中添加验证 - Adding validation in RequestMapping annotation 读取 RequestMapping 注释值 - Read RequestMapping annotation value 给出错误的注释 RequestMapping() - Annotation RequestMapping() giving the error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM