xml文件上:
<!-- 支持类注解 -->
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
<!-- 支持方法注解 -->
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
Java代码:
@RequestMapping("demo")
public class XXX{
@RequestMapping("/demo/login")
public String login(){
}
@RequestMapping("/demo/aad")
public String add(){
}
}