一、前言
在前面的小节中,我们配置了注解驱动和自动扫描包,然后就可以使用SpringMVC相关注解了。
二、@Controller
@Controller用来修饰类,源码如下:
package org.springframework.stereotype;
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;
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Component
public @interface Controller {
String value() default "";
}