一.常用注解 1.@Component 是一种通用注解,可用于任何Bean 2.@Repository 通常用于注解DAO层类,即持久层 3.@Service 通常用于注解Service类,即服务层 4.@Controller 通常用于Controller类,即控制层(MVC) 5.@Autowired 用于注解Bean的属性变量.属性的set()方法和构造函数,默认按照Bean的类型进行装配 默认情况下,找不到合适的Bean会导致autowired失败抛出异常,可通过设置@Autowired的