@ComponentScan是组件扫描注解,用来扫描@Controller @Service @Repository这类@MapperScan 是扫描mapper类的注解,在需要扫描的mapper类上加@Mapper 注:@Repository为spring包下的,@MapperScan为ibatis包下的,如果使用mybatis,建议使用@Mapper