Spring MVC @RequestMapping ...使用方法名称作为动作值?

mom*_*omo 8 java spring-mvc

说我有这个:

@RequestMapping(value="/hello")
public ModelAndView hello(Model model){

    System.out.println("HelloWorldAction.sayHello");
    return null;      
}   
Run Code Online (Sandbox Code Playgroud)

是否可以跳过value ="hello"部分,只需要@RequestMapping注释并让spring使用方法名作为值,类似于:

@RequestMapping
public ModelAndView hello(Model model){

    System.out.println("HelloWorldAction.sayHello");
    return null;      
}
Run Code Online (Sandbox Code Playgroud)

谢谢!

===================编辑=====================

试过这个但没有工作:

@Controller
@RequestMapping(value="admin", method=RequestMethod.GET)
public class AdminController {

    @RequestMapping
    public ResponseEntity<String> hello() { 
      System.out.println("hellooooooo");
    }


}
Run Code Online (Sandbox Code Playgroud)

Bas*_*der 4

尝试在类的请求映射值上添加“/*”

@Controller
@RequestMapping(value="admin/*")
public class AdminController {

    @RequestMapping
    public ResponseEntity<String> hello() { 
      System.out.println("hellooooooo");
    }
}
Run Code Online (Sandbox Code Playgroud)

您可以访问页面http://localhost:8080/website/admin/hello