java自定义注解
问题描述
比如springmvc的requestmapping
//// Source code recreated from a .class file by IntelliJ IDEA// (powered by Fernflower decompiler)//
package org.springframework.web.bind.annotation;
import java.lang.annotation.Documented;import java.lang.annotation.ElementType;import java.lang.annotation.Retention;import java.lang.annotation.RetentionPolicy;import java.lang.annotation.Target;import org.springframework.core.annotation.AliasFor;
@Target({ElementType.METHOD, ElementType.TYPE})@Retention(RetentionPolicy.RUNTIME)@Documented@Mappingpublic @interface RequestMapping {
String name() default '';@AliasFor('path')String[] value() default {};@AliasFor('value')String[] path() default {};RequestMethod[] method() default {};String[] params() default {};String[] headers() default {};String[] consumes() default {};String[] produces() default {};
}
为什么就可以将请求 路由进来啊 实现代码在哪儿呢 什么原理啊???
问题解答
回答1:如果不了解注解相关的知识,可以了解一下注解知识 1、文章1,2、文章2,这两篇讲解的还不错。之后可以百度一下spring mvc requestmapping 源码解读,网上的文章还是蛮多的。源码目前还没有读过,不过基本的原理应该也是通过反射获取到相应的配置,再根据配置进行请求路由。具体的是怎么根据反射获取相应配置的还是要去读一下源码。
回答2:/a/11...
相关文章:
1. boot2docker无法启动2. angular.js - angularjs的自定义过滤器如何给文字加颜色?3. angular.js - angular内容过长展开收起效果4. golang - 用IDE看docker源码时的小问题5. debian - docker依赖的aufs-tools源码哪里可以找到啊?6. docker容器呢SSH为什么连不通呢?7. 关docker hub上有些镜像的tag被标记““This image has vulnerabilities””8. docker api 开发的端口怎么获取?9. mac里的docker如何命令行开启呢?10. docker - 各位电脑上有多少个容器啊?容器一多,自己都搞混了,咋办呢?

网公网安备