使用spring元注释的java合成注释不起作用
我试图使用spring meta annotation@Mapping创建一个组合注释
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Mapping
public @interface RestQuery {
RequestMethod[] method() default {RequestMethod.GET};
String[] produces() default {MediaType.APPLICATION_JSON_VALUE};
String[] consumes() default {""};
String[] value() default {};
String[] params() default {};
}
@Controller
public class CustomerQueryController{
@RestQuery(value="/test")
public String test(){
return "test";
}
}
当我使用上述注释对spring控制器方法进行注释时,我得到一个异常,即URI没有映射。有什么想法吗,我错在哪里了
org.springframework.web.servlet.PageNotFound | No mapping found for HTTP request with URI [/test/] in DispatcherServlet with name ''
共 (0) 个答案