Alias别名
在查看Spring中注解ComponentScan时,点击ComponentScan,
public @interface ComponentScan {

	/**
	 * Alias for {@link #basePackages}.
	 * <p>Allows for more concise annotation declarations if no other attributes
	 * are needed &mdash; for example, {@code @ComponentScan("org.my.pkg")}
	 * instead of {@code @ComponentScan(basePackages = "org.my.pkg")}.
	 */
	@AliasFor("basePackages")
	String[] value() default {};

	/**
	 * Base packages to scan for annotated components.
	 * <p>{@link #value} is an alias for (and mutually exclusive with) this
	 * attribute.
	 * <p>Use {@link #basePackageClasses} for a type-safe alternative to
	 * String-based package names.
	 */
	@AliasFor("value")
	String[] basePackages() default {};
可见value上使用的别名是basePackages,basePackages使用的别名是value,所以这两个写哪一个都可以。
其中ComponentScan的作用是通过注解指定Spring在创建容器时要扫描的包。
value:他和basePackages的作用是一样的,都是用于指定创建容器时要扫描的包。
我们使用此注解就等同于在xml中配置了:
    <!--告诉spring在创建容器时要扫描的包-->
    <context:component-scan base-package="com.itheima"></context:component-scan>
@Configuration
@ComponentScan(basePackages="com.itheima")
public class SpringConfiguration {
}
在源码中我们可以看到
@AliasFor("basePackages")
    String[] value() default {};
value和backPackages这两个属性都是数组,也就是说标准写法是
@ComponentScan(basePackages={"com.itheima"})