在spring中,<context:compent-scan base-package="com.xxx.yyy"/>
可以自动扫所有@Component的类。
以及所有Annotation,其自身具有@Component.具体的有 @Service @Controller @Repository.
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Component
public @interface Controller {
/**
* The value may indicate a suggestion for a logical component name,
* to be turned into a Spring bean in case of an autodetected component.
* @return the suggested component name, if any
*/
String value() default "";
}